public void IssueMoveCommand() { Selectable[] selections = SelectionManager.current.GetSelected(); for (int i = 0; i < selections.Length; i++) { Dragonling dragon = selections[i].GetComponent <Dragonling>(); if (dragon) { if (i == 0) { dragon.MoveTo(transform.position); } else { float invertX = Random.Range(-1f, 1f); invertX = invertX < 0 ? -1f : 1f; float invertZ = Random.Range(-1f, 1f); invertZ = invertZ < 0 ? -1f : 1f; dragon.MoveTo(transform.position + new Vector3(Random.Range(0.5f, 1.2f) * invertX, 0, Random.Range(0.5f, 1.2f) * invertZ)); } } } OnMoveCommand.Invoke(); }
public void IssueSingCommand() { Selectable[] selections = SelectionManager.current.GetSelected(); for (int i = 0; i < selections.Length; i++) { Dragonling dragon = selections[i].GetComponent <Dragonling>(); if (dragon) { dragon.Sing(); } } }