示例#1
0
        private void CommandUnit(Locomotion Unit, Vector3 Point)
        {
            //Flatten point
            Point.y = 0;

            //Flatten position
            Vector3 position = Unit.transform.position;

            position.y = 0;

            //Calculate direction
            Vector3 direction = (position - Point).normalized;

            Unit.Movement  = direction;
            Unit.Direction = direction;
        }
示例#2
0
        private void CommandSelectables(Vector3 Point)
        {
            //Grab selectables
            List <Selectable> selection = selector.Selection;

            if (selection != null)
            {
                //Iterate over selection
                foreach (Selectable selectable in selection)
                {
                    Locomotion locomotion = selectable.GetComponent <Locomotion>();
                    if (locomotion != null)
                    {
                        CommandUnit(locomotion, Point);
                    }
                }
            }
        }
示例#3
0
 //Generic methods
 void Awake()
 {
     locomotion = GetComponent <Locomotion>();
 }
示例#4
0
 private void Start()
 {
     locomotion   = GetComponent <Locomotion>();
     goalPosition = transform.position;
 }