Showing posts with label Strategy Games. Show all posts
Showing posts with label Strategy Games. Show all posts

Monday, August 12, 2013

UNITY: Unity Strategy Games[2]: Mouse Click Feedback (tutorial)


  1. - Raycast information only stores the hit on the first thing it collides with.
  2. - can put object in 'ignore raycast layer'
  3. - nest animations under hierarchy layer: raycast hit to point item group to ground, then use script to animate item position itself for an animated object indicator.
  4. - Input.GetMouseButton(1); // mouse buttons:
    1. button 1 = 0 (Left)
    2. button 2 = 1 (Right)
    3. button 3 = 2 (scrollwheel)
  5. use animation panel to create animations within Unity.
  6. Animation system: can add keyframes and EVENTS.  Events can call for functions like in actionscripting.
  7. Destroy(this.gameObject);
    1. Destroys this game object.
//------------ code bit --------------
void DestroyObject()
{
     Destroy(this.gameObject);
}
//------- end code bit --------------

to destroy parent:


//------------ code bit --------------
void DestroyObject()
{
     Destroy(this.gameObject.transform.parent.gameObject);
}
//------- end code bit --------------



UNITY: Unity Strategy Games[1] Core Mouse Control (tutorial)

I've decided that the only way I'll remember any of the tutorials I've watched is to write notes.  Guess what I'll be using this blog for.

Unity: RTS Mouse Control (by Unity Chat):
http://www.youtube.com/watch?v=g1P2Q9xKCAs

Notes:
- Camera.ScreenPointToRay: draws a line from where you click on screen, to where it lands in 3D space.

- Debug.DrawRay(ray.origin, ray.direction*rayCastLength, Color.yellow);: Draws a yellow indicator of raycast hit.  Can only be seen in the 'SCENE' view.

- to put an item at the mouse location, tell the GameObject (whatever item you want at your mouse point) to make it's transform the position of the ray hit.