public void SetPath(Vector2[] path) { if (path == null || path.Length == 0) { UnityEngine.Debug.Log("PathNull"); return; } if (path.Length > 1) { currentNode = 1; } else { currentNode = 0; } m_path = path; if (isServer) { m_pathRenderer.numPositions = m_path.Length; Vector3[] pathVector3 = new Vector3[m_path.Length]; for (int i = 0; i < m_path.Length; i++) { pathVector3[i] = Utils.Vector2ToVector3(m_path[i]); } m_pathRenderer.SetPositions(pathVector3); m_followingPath = true; m_entityAnimator.ChangeState(EEntityState.Run); } }
private void ChangeState(EAbilityState newState) { m_currentState = newState; switch (newState) { case EAbilityState.MovingCharacter: break; case EAbilityState.CastingState: m_castingTime = m_ability.AbilityBase.CastTime; m_attackerAnimator.ChangeState(m_ability.AbilityBase.CastingAnimation); break; case EAbilityState.PlayingAnimation: m_animationTime = m_attackerAnimator.ChangeState(m_ability.AbilityBase.Animation); //m_animationTime = m_ability.AbilityBase.AnimDuration; m_launchTime = (m_animationTime * m_ability.AbilityBase.AnimationPercentLaunch) / 100; break; case EAbilityState.LaunchProjectileDelayed: break; case EAbilityState.AbilityEnds: m_attacker.EntityBehaviour.StopAllBehaviours(); m_attackerAnimator.ChangeState(EEntityState.Idle); break; default: break; } }
private void ChangeState(EAbilityState newState) { m_currentState = newState; switch (newState) { case EAbilityState.MovingCharacter: break; case EAbilityState.CastingState: m_castingTime = m_ability.AbilityBase.CastTime; m_attackerAnimator.ChangeState(m_ability.AbilityBase.CastingAnimation); break; case EAbilityState.PlayingAnimation: m_animationTime = m_attackerAnimator.ChangeState(m_ability.AbilityBase.Animation); m_launchTime = (m_animationTime * m_ability.AbilityBase.AnimationPercentLaunch) / 100; m_launchParticleTime = (m_animationTime * m_ability.AbilityBase.LaunchParticlePercentLaunch) / 100; break; case EAbilityState.LaunchProjectileDelayed: break; case EAbilityState.AbilityEnds: if (m_ability.AttackType == EAttackType.Basic) { m_attacker.EntityBehaviour.StopAllBehaviours(); m_attackerAnimator.ChangeState(EEntityState.Idle); //TODO: FIX THIS CODE BY CHECKING ON ENTITY IF HAVE ANY TARGET if (m_attacker is CharacterEntity) { m_attacker.EntityBehaviour.AddBehaviour(new AbilitySimpleTarget(m_attacker, m_targets[0], m_ability)); } } else { m_attacker.EntityBehaviour.StopAllBehaviours(); m_attackerAnimator.ChangeState(EEntityState.Idle); } break; default: break; } }
public virtual void Die(DamageProcess damageProcess) { if (OnDeathCallBack != null) { OnDeathCallBack(damageProcess); } m_entityAbilities.RemoveAllSideEffects(); EntityBehaviour.StopAllBehaviours(); StopAgent(false); m_dead = true; EntityAnimator.ChangeState(EEntityState.Dead); if (!string.IsNullOrEmpty(DeathParticlePrefab)) { RpcSpawnDeathParticle(); m_deathParticle = SpawnManager.instance.InstantiatePool(DeathParticlePrefab, Vector3.zero, Quaternion.identity); EntityTransform canvasTrasnform = GetTransformPosition(DeathParticlePosition); m_deathParticle.transform.SetParent(canvasTrasnform.transform); m_deathParticle.transform.localPosition = Vector3.zero; } switch (RespawnType) { case EEntityRespawnType.NoRespawn: break; case EEntityRespawnType.NoRespawnAndDestroy: StartCoroutine(NoRespawnAndDestroyCoroutine()); break; case EEntityRespawnType.RespawnAndReset: StartCoroutine(RespawnAndResetCoroutine()); break; default: break; } }