protected override void Start() { base.Start(); m_currentSpeed = 1; m_lastFlyingMotion = m_currentFlyingMotion; }
//------------------------------------------------------------------------- public void SetMovingWay(FlyingMotionTypes motionType) { m_currentFlyingMotion = motionType; }
//------------------------------------------------------------------------- public override void SetSpeed(TOLEnemyStateGeneric state) { if (m_init) { // m_current speed is merely used for stop movement or resume (0/1) //modify m_actualVelocity for differences if (state is TOLEnemyStatePatrol || state is TOLEnemyStatePatrolReturn || state is TOLEnemyStateSwarmLead) { m_currentSpeed = 1; m_currentFlyingMotion = m_lastFlyingMotion; m_actualVelocity = patrolSpeed; } else if(state is TOLEnemyStateFlyingPatrol) { m_currentSpeed = 1; m_currentFlyingMotion = m_lastFlyingMotion; m_actualVelocity = patrolSpeed; } else if (state is TOLEnemyStatePursuit) { m_currentSpeed = 1; m_currentFlyingMotion = FlyingMotionTypes.StraightLine; m_actualVelocity = pursuitSpeed; }else if(state is TOLEnemyStateFlyingPursuit) { m_currentSpeed = 1; m_currentFlyingMotion = FlyingMotionTypes.StraightLine; m_actualVelocity = pursuitSpeed; } else if (state is TOLEnemyStateSearch) { m_currentSpeed = 1; m_actualVelocity = searchSpeed; } else if (state is TOLEnemyStateFlyingSearch) { m_currentFlyingMotion = FlyingMotionTypes.StraightLine; m_currentSpeed = 1; m_actualVelocity = 2; } else if(state is TOLEnemyStateFlyingAttack) { if(((TOLEnemyController)m_owner).GetFlyingEnemyAttackState() == TOLEnemyController.FlyingEnemyAttackState.Aim) { m_currentSpeed = 3; m_actualVelocity = 3; } else if (((TOLEnemyController)m_owner).GetFlyingEnemyAttackState() == TOLEnemyController.FlyingEnemyAttackState.Hoover) { m_currentSpeed = 5; m_actualVelocity = 5; } else { m_currentSpeed = 1; m_actualVelocity = 1; } } else if(state is TOLEnemyStateFlyingSearch) { m_currentSpeed = 1; m_actualVelocity = searchSpeed; } } }
//------------------------------------------------------------------------- public override void PatrolReturn(Transform patrolPt) { if (m_owner.IsLocal() || m_owner.IsMine()) { m_init = true; m_srcPosition = transform.position; if (BoidInfo.isSwarmingEnemy) { m_currentFlyingMotion = FlyingMotionTypes.Swarm; } if (chaseTriggerTarget != null) { m_dest = chaseTriggerTarget; m_destPosition = chaseTriggerTarget.position; } else { m_dest = patrolPt; m_destPosition = patrolPt.position; } } }