private void TrySpellCast(EntityId targetEntityId, SpellType spellType) { if (SpatialOS.Universe.ContainsEntity(targetEntityId)) { var targetEntity = SpatialOS.Universe.Get(targetEntityId); spellsBehaviour.CastSpell(spellType, targetEntity.UnderlyingGameObject.transform.position); } StartCoroutine(ChangeAfter(WizardFSMState.StateEnum.IDLE, SimulationSettings.PlayerCastAnimationTime)); }
private void CastRainOnTarget() { var targetGameObject = NPCUtils.GetTargetGameObject(Owner.Data.targetEntityId); if (targetGameObject == null) { Owner.TriggerTransition(WizardFSMState.StateEnum.IDLE, new EntityId(), SimulationSettings.InvalidPosition); return; } if (NPCUtils.IsTargetDefendable(parentBehaviour.gameObject, targetGameObject)) { spellsBehaviour.CastSpell(SpellType.RAIN, targetGameObject.transform.position); } spellCastFinishDelayCoroutine = parentBehaviour.StartCoroutine(TimerUtils.WaitAndPerform(SimulationSettings.PlayerCastAnimationTime, () => { Owner.TriggerTransition(WizardFSMState.StateEnum.IDLE, new EntityId(), SimulationSettings.InvalidPosition); })); }