public virtual void StartSkillCasting() { startAiming = false; if (targetPosition == null) { targetPosition = transform.position; } Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity)) { targetPosition = hit.point; targetPosition = new Vector3(targetPosition.x, owner.transform.position.y, targetPosition.z); } transform.position = targetPosition; if (spawnType == SpawnSkillType.FromCaster) { Debug.Log("FROM CASTER!"); transform.position = new Vector3(owner.transform.position.x, owner.transform.position.y, owner.transform.position.z); activate = true; } else { activate = true; } owner.ReceiveOrder(UnitOrder.GenerateIdleOrder(), true); owner.MakeUnitLookAt(targetPosition); transform.rotation = owner.transform.rotation; }
public override void EndIndividualInteraction(UnitBaseBehaviourComponent unit) { if (gathererStats.Contains(gathererStats.Find(x => x.unitSaved == unit))) { gathererStats.Remove(gathererStats.Find(x => x.unitSaved == unit)); interactingUnit.Remove(unit); if (unit.interactWith == this) { unit.ReceiveOrder(UnitOrder.GenerateIdleOrder()); } } }
public override void EndAllInteraction() { List <UnitBaseBehaviourComponent> tmp = interactingUnit; foreach (UnitBaseBehaviourComponent item in tmp) { if (item.currentCommand == Commands.GATHER_RESOURCES) { item.ReceiveOrder(UnitOrder.GenerateIdleOrder()); } } SpawnReward(); interactingUnit.Clear(); gathererStats.Clear(); }