예제 #1
0
 private void ResetState()
 {
     state     = EMPState.Inactive;
     Activated = false;
     Agent.AI.m_navMeshAgent.isStopped        = false;
     Agent.AI.m_abilities.CanTriggerAbilities = true;
 }
예제 #2
0
        public void Update()
        {
            if (!Triggered)
            {
                return;
            }
            Timer += Time.deltaTime;

            switch (state)
            {
            case EMPState.BuildUp:
                state = EMPState.WaveStart;
                break;

            case EMPState.WaveStart:
                if (stateTimer < Clock.Time)
                {
                    LightWave();
                    stateTimer = Clock.Time + 1.5f;
                    state      = EMPState.LightOffSFX;
                }
                break;

            case EMPState.LightOffSFX:
                EnemyAgent.Voice.PlayVoiceEvent(EVENTS.LIGHTS_OFF_GLOBAL);
                state = EMPState.WaveExpand;
                break;

            case EMPState.WaveExpand:
                if (stateTimer < Clock.Time)
                {
                    state = EMPState.WaveEnd;
                }
                if (fogSphereAdd.IsAllocated)
                {
                    float num = 1f - (stateTimer - Clock.Time) / 1.5f;
                    fogSphereAdd.SetPositionRange(fogPos, Mathf.Lerp(2f, 130f, num));
                    float t = Mathf.Pow(num, 32f);
                    fogSphereAdd.SetDensity(Mathf.Lerp(1f, 0f, t));
                    if (fogSphereSub.IsAllocated)
                    {
                        fogSphereSub.SetPositionRange(fogPos, Mathf.Lerp(0f, 90f, num));
                        fogSphereSub.SetDensity(Mathf.Lerp(-10f, 0f, t));
                        return;
                    }
                }
                break;

            case EMPState.WaveEnd:
                if (stateTimer < Clock.Time)
                {
                    fogSphereAdd.Deallocate();
                    fogSphereSub.Deallocate();
                    state = EMPState.Done;
                }
                break;

            case EMPState.Done:

                break;
            }

            if (Timer >= EMPConfig.Duration)
            {
                Destroy(gameObject);
            }
        }
예제 #3
0
        public void Update()
        {
            if (Agent.Locomotion.CurrentStateEnum != ES_StateEnum.TriggerFogSphere && Activated == true)
            {
                ResetState();
            }


            switch (state)
            {
            case EMPState.Inactive:
                Agent.Appearance.InterpolateGlow(GlowColor, new Vector4(0f, 1.25f, 0f, 1.5f), 1f);
                break;

            case EMPState.Build:
                Agent.AI.m_navMeshAgent.velocity = Vector3.zero;
                if (Agent.AI.m_navMeshAgent.isOnNavMesh)
                {
                    Agent.AI.m_navMeshAgent.isStopped = true;
                }
                Agent.AI.m_abilities.CanTriggerAbilities = false;

                Agent.Appearance.InterpolateGlow(GlowColor * 5, new Vector4(0f, 1.25f, 0f, 1.5f), 1f);

                Agent.Locomotion.m_animator.CrossFadeInFixedTime(EnemyLocomotion.s_hashAbilityUse[0], 2f);
                Agent.Voice.PlayVoiceEvent(EVENTS.INFECTION_SPITTER_PRIMED);

                state      = EMPState.Activate;
                stateTimer = Clock.Time + 2f;
                break;

            case EMPState.Activate:
                if (stateTimer < Clock.Time)
                {
                    Agent.Voice.PlayVoiceEvent(EVENTS.INFECTION_SPITTER_SPIT);
                    TriggerEMP();

                    Agent.Locomotion.m_animator.CrossFadeInFixedTime(EnemyLocomotion.s_hashAbilityUseOut[0], 0.15f);
                    Agent.Appearance.InterpolateGlow(GlowColor, new Vector4(0f, 1.25f, 0f, 1.5f), 0.15f);

                    state      = EMPState.Cooldown;
                    stateTimer = Clock.Time + 3f;
                }
                break;

            case EMPState.Cooldown:
                if (stateTimer < Clock.Time)
                {
                    ResetState();
                    Agent.Locomotion.ChangeState((int)ES_StateEnum.PathMove);
                }
                break;
            }


            if (!Agent.Alive)
            {
                Agent.Appearance.InterpolateGlow(Color.black, new Vector4(0f, 1.25f, 0f, 1.5f), 2f);
                Destroy(this);
            }
        }
예제 #4
0
 public override bool Trigger()
 {
     Activated = true;
     state     = EMPState.Build;
     return(false);
 }
예제 #5
0
        public override void Update(GameTime currentGameTime)
        {
            foreach (Ship ship in StateManager.EnemyShips)
            {
                if (ship.Intersects(this) && ship.ShipType != ShipType.EnemyBoss && ship.ShipType != ShipType.EnemyBossesClones)
                {
                    //TODO: Consider storing BaseEnemyShip in StateManager.EnemyShips to avoid casting
                    ship.Cast<Ships.Enemies.BaseEnemyShip>().isEMPed = true;
                }
            }
            switch (_EMPState)
            {
                default:
                case CoreTypes.EMPState.Stowed:

                    break;

                case CoreTypes.EMPState.Deployed:

                    if (!_hasDeployInited)
                    {
                        _pointOfOrigin = ParentShip.WorldCoords;
                        if (StateManager.Options.SFXEnabled)
                        {
                            DeploySound.Play();
                        }
                        _hasDeployInited = true;
                    }

                    ShouldDraw = true;

                    elapsedUpdateDelay += currentGameTime.ElapsedGameTime;
                    if (elapsedUpdateDelay > updateDelay)
                    {
                        elapsedUpdateDelay = TimeSpan.Zero;
                        this.Scale += new Vector2(.015f, .015f);
                    }

                    elapsedMaxTime += currentGameTime.ElapsedGameTime;
                    if (elapsedMaxTime > maxTime)
                    {
                        _EMPState = EMPState.RIP;
                    }

                    break;

                case CoreTypes.EMPState.RIP:
                    FireKilledEvent();
                    break;

            }
            if (ShouldDraw && firstShouldDraw)
            {
                Position = ParentShip.WorldCoords;
                firstShouldDraw = false;
            }
        }