void AddOrSet(UnitAI uai, Command c) { if (Input.GetKey(KeyCode.LeftShift)) { uai.AddCommand(c); } else { uai.SetCommand(c); } }
public void CreateIntercept(Entity source, Entity target, bool isAdd) { Intercept intercept = new Intercept(source, target); UnitAI uai = source.GetComponent <UnitAI>(); if (isAdd) { uai.AddCommand(intercept); } else { uai.SetCommand(intercept); } }
// Update is called once per frame void Update() { foreach (Monster mon in monsters) { close = PlayerCloseEnough(mon); if (close) { //Debug.Log("ADDING INTERCEPT "); Intercept intercept = new Intercept(mon, Player.inst); UnitAI uai = mon.GetComponent <UnitAI>(); uai.AddCommand(intercept); //Debug.Log(mon.velocity); } //Debug.Log("Player close false "); } }
void HandleMove(Vector3 point) { Move m = new Move(SelectionMgr.inst.selectedEntity, hit.point); UnitAI uai = SelectionMgr.inst.selectedEntity.GetComponent <UnitAI>(); //AddOrSet(uai, m); if (Input.GetKey(KeyCode.LeftShift)) { uai.AddCommand(m); } else { uai.SetCommand(m); } }