public void Update() { if (!isLocalPlayer) { return; } // When move button pressed, place movement marker and move currently selected units. if (InputManager.IsDown("Move To")) { if (arrow == null) { arrow = Pool.Get(TargetArrowPrefab).GetComponent <TargetArrow>(); arrow.ReturnToPool = false; } arrow.PlaceAt(InputManager.MousePos); timer = 0f; removed = false; // Call the data-oriented move units function. // Works on both client and server. this.MoveUnits(InputManager.MousePos); } timer += Time.unscaledDeltaTime; if (timer >= ActiveTime && !removed && arrow != null) { removed = true; arrow.Remove(); } }
/// <summary> /// Instantiate Target Arrow And Possible Target Arrows Based On Character Amount /// </summary> /// <param name="arrowAmount"></param> public void CreateArrows(int arrowAmount) { _targetArrow = Instantiate(_targetArrowPrefab); _targetArrow.gameObject.SetActive(false); for (int i = 0; i < arrowAmount; i++) { PossibleTargetArrows.Add(Instantiate(_possibleTargetArrowPrefab)); PossibleTargetArrows[i].gameObject.SetActive(false); } }
private void OnTriggerExit2D(Collider2D collision) { TargetArrow arrow = collision.GetComponent <TargetArrow>(); if (arrow) { arrow.Target = null; selectBorder.SetActive(false); } }
private void OnTriggerEnter2D(Collider2D collision) { TargetArrow arrow = collision.GetComponent <TargetArrow>(); if (arrow) { arrow.Target = this; selectBorder.SetActive(true); } }
public void Add(GameObject hTarget) { if (GuiArrows.Count == 0) throw new System.Exception("Radar Player Limit Reached!"); TargetArrow vNew = new TargetArrow(); vNew.Target = hTarget; vNew.Arrow = GuiArrows.Last(); vNew.Arrow.enabled = true; GuiArrows.RemoveAt(GuiArrows.Count - 1); m_hArrows.Add(vNew); }
void Awake() { instance = this; // setup singleton }