private void PatrolAllSelectedUnits() { var destination = (Vector3)RtsManager.Current.ScreenPointToMapPosition(Input.mousePosition); foreach (var Unit in MouseManager.Current.Selections) { Unit.GetComponent <CommandManager>().AddCommand(Cmd_Patrol.New(Unit.gameObject, destination)); } }
// Update is called once per frame void Update() { if (selected && Input.GetKey(KeyCode.P)) { Vector3 tempTarget = (Vector3)RtsManager.Current.ScreenPointToMapPosition(Input.mousePosition); commandManager.AddCommand(Cmd_Patrol.New(transform.gameObject, tempTarget)); } if (selected && Input.GetKey(KeyCode.F)) { Vector3 tempTarget = (Vector3)RtsManager.Current.ScreenPointToMapPosition(Input.mousePosition); commandManager.AddCommand(Cmd_Patrol.New(transform.gameObject, tempTarget)); } }