protected override void OnSuddenDeath() { if (mRock) { mRock.Release(); mRock = null; mRockCtrl = null; mRockBlinkDelay = null; } base.OnSuddenDeath(); }
protected override void StateChanged() { switch ((EntityState)prevState) { case EntityState.Normal: CancelInvoke(activeFunc); //CancelInvoke(fireStartFunc); mFiring = false; Blink(0); if (projInactiveInvul) { stats.isInvul = false; } bodySpriteCtrl.StopOverrideClip(); break; } base.StateChanged(); switch ((EntityState)state) { case EntityState.Normal: CancelInvoke(activeFunc); //CancelInvoke(fireStartFunc); mFiring = false; if (!mRock) { Vector3 rockPos = transform.position; rockPos.y += rockYOfs; mRock = Projectile.Create(projGroup, rockProjType, rockPos, Vector3.zero, null); mRockCtrl = mRock.GetComponent <PlatformerController>(); mRockBlinkDelay = mRock.GetComponent <EntityBlinkDelay>(); bodySpriteCtrl.controller = mRockCtrl; if (rollerDieDelayOverride) { mRock.dieBlink = false; mRock.dieDelay = 0.0f; } } mRockCtrl.dirHolder = transform; mRockCtrl.moveSideLock = true; mRockCtrl.moveSide = defaultMoveSide; if (mRockBlinkDelay) { mRockBlinkDelay.enabled = false; } if (mSensor) { mSensor.Activate(true); } if (!string.IsNullOrEmpty(projType)) { if (mPlayers == null) { mPlayers = GameObject.FindGameObjectsWithTag("Player"); } InvokeRepeating(activeFunc, 0, projActiveCheckDelay); if (projInactiveInvul) { stats.isInvul = true; } if (!string.IsNullOrEmpty(projInactiveClip)) { bodySpriteCtrl.PlayOverrideClip(projInactiveClip); } } //Invoke(fireStartFunc, projStartDelay); break; case EntityState.Stun: mRockCtrl.moveSide = 0.0f; break; case EntityState.Dead: if (mRock && mRock.isAlive) { if (rollerDieDelayOverride) { if (mRockBlinkDelay) { mRockBlinkDelay.delay = rollerDieDelay - rollerDieBlinkDelay; mRockBlinkDelay.enabled = true; } else { mRock.dieBlink = true; } mRock.dieDelay = rollerDieDelay; } if (mRock.stats) { mRock.stats.curHP = 0; } else { mRock.state = (int)Projectile.State.Dying; } mRock = null; } if (mSensor) { mSensor.Activate(false); } bodySpriteCtrl.controller = null; break; case EntityState.RespawnWait: if (mRock && !mRock.isReleased) { mRock.Release(); mRock = null; mRockCtrl = null; mRockBlinkDelay = null; } if (mSensor) { mSensor.Activate(false); } bodySpriteCtrl.controller = null; RevertTransform(); break; } }
protected override void StateChanged() { switch((EntityState)prevState) { case EntityState.Normal: CancelInvoke(activeFunc); //CancelInvoke(fireStartFunc); mFiring = false; Blink(0); if(projInactiveInvul) stats.isInvul = false; bodySpriteCtrl.StopOverrideClip(); break; } base.StateChanged(); switch((EntityState)state) { case EntityState.Normal: CancelInvoke(activeFunc); //CancelInvoke(fireStartFunc); mFiring = false; if(!mRock) { Vector3 rockPos = transform.position; rockPos.y += rockYOfs; mRock = Projectile.Create(projGroup, rockProjType, rockPos, Vector3.zero, null); mRockCtrl = mRock.GetComponent<PlatformerController>(); mRockBlinkDelay = mRock.GetComponent<EntityBlinkDelay>(); bodySpriteCtrl.controller = mRockCtrl; if(rollerDieDelayOverride) { mRock.dieBlink = false; mRock.dieDelay = 0.0f; } } mRockCtrl.dirHolder = transform; mRockCtrl.moveSideLock = true; mRockCtrl.moveSide = defaultMoveSide; if(mRockBlinkDelay) mRockBlinkDelay.enabled = false; if(mSensor) { mSensor.Activate(true); } if(!string.IsNullOrEmpty(projType)) { if(mPlayers == null) mPlayers = GameObject.FindGameObjectsWithTag("Player"); InvokeRepeating(activeFunc, 0, projActiveCheckDelay); if(projInactiveInvul) stats.isInvul = true; if(!string.IsNullOrEmpty(projInactiveClip)) bodySpriteCtrl.PlayOverrideClip(projInactiveClip); } //Invoke(fireStartFunc, projStartDelay); break; case EntityState.Stun: mRockCtrl.moveSide = 0.0f; break; case EntityState.Dead: if(mRock && mRock.isAlive) { if(rollerDieDelayOverride) { if(mRockBlinkDelay) { mRockBlinkDelay.delay = rollerDieDelay - rollerDieBlinkDelay; mRockBlinkDelay.enabled = true; } else { mRock.dieBlink = true; } mRock.dieDelay = rollerDieDelay; } if(mRock.stats) mRock.stats.curHP = 0; else mRock.state = (int)Projectile.State.Dying; mRock = null; } if(mSensor) { mSensor.Activate(false); } bodySpriteCtrl.controller = null; break; case EntityState.RespawnWait: if(mRock && !mRock.isReleased) { mRock.Release(); mRock = null; mRockCtrl = null; mRockBlinkDelay = null; } if(mSensor) { mSensor.Activate(false); } bodySpriteCtrl.controller = null; RevertTransform(); break; } }