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; }
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); } } } }
//Generic methods void Awake() { locomotion = GetComponent <Locomotion>(); }
private void Start() { locomotion = GetComponent <Locomotion>(); goalPosition = transform.position; }