/// <summary> /// this command will move between the two given points indefinitely. it enables targeting. /// </summary> public static Cmd_Patrol New(GameObject prGameObject, Vector3 prPoint) { Cmd_Patrol newcommand = prGameObject.AddComponent <Cmd_Patrol>(); newcommand.pointA = prPoint; return(newcommand); }
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)); } }