public void EventHandler(SCG_Event e) { Event_EnemyBulletHit bH = e as Event_EnemyBulletHit; if (bH != null) { oneShotSource.PlayOneShot(gameModel.sfx_EnemyBulletHit); } Event_PlayerShieldBlock sB = e as Event_PlayerShieldBlock; if (sB != null) { oneShotSource.PlayOneShot(gameModel.sfx_Shield_Block); } Event_PlayerExplode pE = e as Event_PlayerExplode; if (pE != null) { oneShotSource.PlayOneShot(gameModel.sfx_ShipExplode); } Event_LanceHit lH = e as Event_LanceHit; if (lH != null) { GameObject g = gameAssets.Make(MyGameAsset.SFX, lH.location); g.GetComponent <AudioSource>().PlayOneShot(gameModel.sfx_LanceHit); } }
public void EnemyDeathEventHandler(SCG_Event e) { Event_EnemyDeath eD = e as Event_EnemyDeath; if (eD != null) { if (eD.enemyToBeDestroyed != myE) { return; } SCG_EventManager.instance.Unregister <Event_EnemyDeath>(EnemyDeathEventHandler); SCG_EventManager.instance.Unregister <Event_DumpReg>(EnemyDeathEventHandler); SCG_EventManager.instance.Fire(new Event_BonusPoints(174)); Instantiate(flameOut, transform.position, Quaternion.identity); Destroy(this.gameObject); } Event_DumpReg d = e as Event_DumpReg; if (d != null) { SCG_EventManager.instance.Unregister <Event_EnemyDeath>(EnemyDeathEventHandler); SCG_EventManager.instance.Unregister <Event_DumpReg>(EnemyDeathEventHandler); } }
public void EnemyDeathEventHandler(SCG_Event e) { //Debug.Log("Message Received"); Event_EnemyDeath d = e as Event_EnemyDeath; if (d != null) { if (_swarm.Contains(d.enemyToBeDestroyed.gameObject)) { int indexToRemove = _swarm.IndexOf(d.enemyToBeDestroyed.gameObject); _swarm.RemoveAt(indexToRemove); _dirs.RemoveAt(indexToRemove); _attackMode.RemoveAt(indexToRemove); Destroy(d.enemyToBeDestroyed.gameObject); } } Event_DumpReg dr = e as Event_DumpReg; if (dr != null) { SCG_EventManager.instance.Unregister <Event_EnemyDeath>(EnemyDeathEventHandler); SCG_EventManager.instance.Unregister <Event_DumpReg>(EnemyDeathEventHandler); } }
public void EventHandler(SCG_Event e) { Event_Restart r = e as Event_Restart; if (r != null) { SetColors(AestheticMode.Normal); } }
public void EventHandler(SCG_Event e) { Event_LevelClear lc = e as Event_LevelClear; if (lc != null) { _fsm.TransitionTo <Delay>(); } }
public void EventHandler(SCG_Event e) { Event_EnemyBulletHit bH = e as Event_EnemyBulletHit; if (bH != null) { Vector2 shakeRotOffset = popMagnitudeMax * Vector3.Normalize(Random.insideUnitCircle); Vector3 eulerToPush = holoPlay.eulerAngles; eulerToPush += (Vector3)shakeRotOffset; holoPlay.rotation = Quaternion.Euler(eulerToPush); } }
public void EventHandler(SCG_Event e) { Event_Restart r = e as Event_Restart; if (r != null) { SCG_EventManager.instance.Fire(new Event_DumpReg()); Destroy(baddieParent); baddieParent = new GameObject("BaddieParent"); baddieParent.transform.SetParent(ServiceLocator.instance.Controller); _fsm.TransitionTo <FirstWait>(); } }
private void EventHandler(SCG_Event e) { Event_PlayerBulletHit p = e as Event_PlayerBulletHit; if (p != null) { if (p.enemyHit == this) { hitpoints_Current -= p.enemyDamageTaken; } } Event_LanceHit s = e as Event_LanceHit; if (s != null) { if (s.enemyHit == this) { if (s.trueEnterFalseExit) { hitpoints_Current -= gameModel.d_Lance_Damage; } isInLance = s.trueEnterFalseExit; } } Event_ExplosionBallHit x = e as Event_ExplosionBallHit; if (x != null) { if (x.enemyHit == this) { isInExplosionBall = x.trueEnterFalseExit; } } Event_PlayerRocketHit r = e as Event_PlayerRocketHit; if (r != null) { if (r.enemyHit == this) { hitpoints_Current -= r.damageTaken; } } }
public void EventHandler(SCG_Event e) { Event_EnemyBulletHit eBH = e as Event_EnemyBulletHit; if (eBH != null) { jPBImage.color = gameModel.c_Hot; hpFill.color = lifeHit; } Event_LifeUpTick lUT = e as Event_LifeUpTick; if (lUT != null) { hpFill.color = lifeTick; } }
public void EventHandler(SCG_Event e) { Event_PlayerShieldBlock psb = e as Event_PlayerShieldBlock; if (psb != null) { c0 = playModel.appliedBulletColor; c1 = playModel.appliedBulletColor; return; } Event_EnemyBulletHit ebb = e as Event_EnemyBulletHit; if (ebb != null) { playerShotPS.Emit(10); } }
public void EventHandler(SCG_Event e) { if (playModel.shieldSize == gameModel.f_Shield_Cutoff_Min) { Event_PlayerShieldBlock psb = e as Event_PlayerShieldBlock; if (psb != null) { float outCome = Random.Range(0.000f, 1.0000f); if (outCome <= bouncePerc) { GameObject bullet = assetManager.Make(MyGameAsset.Bullet, ServiceLocator.instance.Player.position + (Vector3)playModel.shieldDirection); bullet.transform.localScale = Vector3.one * 5; bullet.GetComponent <Behavior_Bullet>().bounced = true; bullet.GetComponent <Rigidbody>().AddForce((Vector3)playModel.shieldDirection * gameModel.s_Guns_BulletSpeed * 2.8f, ForceMode.Impulse); } } } }
public void EventHandler(SCG_Event e) { Event_EnemyDeath eD = e as Event_EnemyDeath; if (eD != null) { if (myE == eD.enemyToBeDestroyed) { SCG_EventManager.instance.Fire(new Event_BonusPoints(161)); SCG_EventManager.instance.Unregister <Event_DumpReg>(EventHandler); SCG_EventManager.instance.Unregister <Event_EnemyDeath>(EventHandler); Destroy(this.gameObject); } } Event_DumpReg d = e as Event_DumpReg; if (d != null) { SCG_EventManager.instance.Unregister <Event_EnemyDeath>(EventHandler); SCG_EventManager.instance.Unregister <Event_DumpReg>(EventHandler); } }
public void EventHandler(SCG_Event e) { Event_PlayerShieldBlock psb = e as Event_PlayerShieldBlock; if (psb != null) { if (heatModel.active_Shield) { heatModel.heat_Shield += gameModel.f_Shield_ActiveBlockPenalty; } } Event_Restart restart = e as Event_Restart; Event_Respawn respawn = e as Event_Respawn; if (restart != null || respawn != null) { heatModel.heat_Guns = 0; heatModel.heat_Lance = 0; heatModel.heat_Rockets = 0; heatModel.heat_Shield = 0; heatModel.heat_Thrusters = 0; } }
public void EventHandler(SCG_Event e) { if (playModel.currentPlayerState == PlayerState.Alive) { float timeDip = 1; Event_PlayerBulletHit bh = e as Event_PlayerBulletHit; if (bh != null) { timeDip = .5f; } Event_PlayerRocketHit rh = e as Event_PlayerRocketHit; if (rh != null) { timeDip = .1f; } Event_LanceHit lh = e as Event_LanceHit; if (lh != null) { timeDip = .65f; } Event_EnemyDeath ed = e as Event_EnemyDeath; if (ed != null) { timeDip = .06f; } if (timeDip <= Time.timeScale) { Time.timeScale = timeDip; } } }
public void EventHandler(SCG_Event e) { Event_BonusPoints bp = e as Event_BonusPoints; if (bp != null) { sadModel.score += bp.score; return; } Event_PlayerBulletHit bh = e as Event_PlayerBulletHit; if (bh != null) { sadModel.score += 7; return; } Event_PlayerShieldBlock sb = e as Event_PlayerShieldBlock; if (sb != null) { sadModel.score += 12; return; } Event_EnemyDeath ed = e as Event_EnemyDeath; if (ed != null) { sadModel.score += 100; return; } Event_PlayerRocketHit rh = e as Event_PlayerRocketHit; if (rh != null) { sadModel.score += 21; return; } Event_LanceHit sh = e as Event_LanceHit; if (sh != null) { sadModel.score += 3; } Event_LevelClear lc = e as Event_LevelClear; if (lc != null) { sadModel.lastScore = sadModel.endScore; sadModel.endScore = sadModel.score; } Event_Restart r = e as Event_Restart; if (r != null) { sadModel.lastScore = 0; sadModel.endScore = 0; sadModel.score = 0; sadModel.difficulty = 0; sadModel.level = 1; } }
public void EventHandler(SCG_Event e) { Event_Audio a = e as Event_Audio; if (a != null) { if (a.type == AudioEvent.LD_Port) { if (LD_PortNum == 0) { left.PlayOneShot(gameModel.LD_Port[0]); LD_PortNum = 1; } else { left.PlayOneShot(gameModel.LD_Port[1]); LD_PortNum = 0; } } else if (a.type == AudioEvent.LD_Stbd) { if (LD_StbdNum == 0) { right.PlayOneShot(gameModel.LD_Stbd[0]); LD_StbdNum = 1; } else { right.PlayOneShot(gameModel.LD_Stbd[1]); LD_StbdNum = 0; } } else if (a.type == AudioEvent.Contact) { both.PlayOneShot(gameModel.Contact_General); } else if (a.type == AudioEvent.CriticalError) { int num = Random.Range(0, gameModel.CriticalError.Length); while (num == CriticalNum) { num = Random.Range(0, gameModel.CriticalError.Length); } CriticalNum = num; both.PlayOneShot(gameModel.CriticalError[CriticalNum]); } else if (a.type == AudioEvent.Danger) { both.PlayOneShot(gameModel.Danger_JC); } else if (a.type == AudioEvent.O_Guns) { int num = Random.Range(0, gameModel.Online_Guns.Length); while (num == GunNum) { num = Random.Range(0, gameModel.Online_Guns.Length); } GunNum = num; if (playModel.leftStation == Stations.Guns) { if (left.isPlaying) { left.Stop(); } left.clip = (gameModel.Online_Guns[GunNum]); left.Play(); } else { if (right.isPlaying) { right.Stop(); } right.clip = (gameModel.Online_Guns[GunNum]); right.Play(); } } else if (a.type == AudioEvent.O_Lance) { int num = Random.Range(0, gameModel.Online_Lance.Length); while (num == LanceNum) { num = Random.Range(0, gameModel.Online_Lance.Length); } LanceNum = num; if (playModel.leftStation == Stations.Lance) { if (left.isPlaying) { left.Stop(); } left.clip = (gameModel.Online_Lance[LanceNum]); left.Play(); } else { if (right.isPlaying) { right.Stop(); } right.clip = (gameModel.Online_Lance[LanceNum]); right.Play(); } } else if (a.type == AudioEvent.O_Rockets) { int num = Random.Range(0, gameModel.Online_Rockets.Length); while (num == RocketsNum) { num = Random.Range(0, gameModel.Online_Rockets.Length); } RocketsNum = num; if (playModel.leftStation == Stations.Rockets) { if (left.isPlaying) { left.Stop(); } left.clip = (gameModel.Online_Rockets[RocketsNum]); left.Play(); } else { if (right.isPlaying) { right.Stop(); } right.clip = (gameModel.Online_Rockets[RocketsNum]); right.Play(); } } else if (a.type == AudioEvent.O_Shield) { int num = Random.Range(0, gameModel.Online_Shields.Length); while (num == ShieldNum) { num = Random.Range(0, gameModel.Online_Shields.Length); } ShieldNum = num; if (playModel.leftStation == Stations.Shield) { if (left.isPlaying) { left.Stop(); } left.clip = (gameModel.Online_Shields[ShieldNum]); left.Play(); } else { if (right.isPlaying) { right.Stop(); } right.clip = (gameModel.Online_Shields[ShieldNum]); right.Play(); } } else if (a.type == AudioEvent.O_Thrusters) { int num = Random.Range(0, gameModel.Online_Thrusters.Length); while (num == ThrustersNum) { num = Random.Range(0, gameModel.Online_Thrusters.Length); } ThrustersNum = num; if (playModel.leftStation == Stations.Thrusters) { if (left.isPlaying) { left.Stop(); } left.clip = (gameModel.Online_Thrusters[ThrustersNum]); left.Play(); } else { if (right.isPlaying) { right.Stop(); } right.clip = (gameModel.Online_Thrusters[ThrustersNum]); right.Play(); } } else if (a.type == AudioEvent.Welcome) { both.PlayOneShot(gameModel.Welcome); } else if (a.type == AudioEvent.W_Guns) { if (playModel.leftStation == Stations.Guns) { left.PlayOneShot(gameModel.Warning_Guns); } else { right.PlayOneShot(gameModel.Warning_Guns); } } else if (a.type == AudioEvent.W_Lance) { if (playModel.leftStation == Stations.Lance) { left.PlayOneShot(gameModel.Warning_Lance); } else { right.PlayOneShot(gameModel.Warning_Lance); } } else if (a.type == AudioEvent.W_Rockets) { if (playModel.leftStation == Stations.Rockets) { left.PlayOneShot(gameModel.Warning_Rockets); } else { right.PlayOneShot(gameModel.Warning_Rockets); } } else if (a.type == AudioEvent.W_Shield) { if (playModel.leftStation == Stations.Shield) { left.PlayOneShot(gameModel.Warning_Shields); } else { right.PlayOneShot(gameModel.Warning_Shields); } } else if (a.type == AudioEvent.W_Thrusters) { if (playModel.leftStation == Stations.Thrusters) { left.PlayOneShot(gameModel.Warning_Thrusters); } else { right.PlayOneShot(gameModel.Warning_Thrusters); } } else if (a.type == AudioEvent.W_System) { both.PlayOneShot(gameModel.Warning_System); } } }
void EffectsEventHandler(SCG_Event e) { Event_PlayerBulletHit bH = e as Event_PlayerBulletHit; if (bH != null) { if (_IsBulletActiveCheck(bH.bullet.gameObject)) { Make(MyGameAsset.BulletExplosion, bH.location); int indexOfBullet = bullets_Active.IndexOf(bH.bullet.gameObject); _StowActiveBullet(indexOfBullet); return; } } Event_PlayerRocketHit rH = e as Event_PlayerRocketHit; if (rH != null) { if (_IsGOActiveCheck(rH.altRocket.gameObject, rockets_Active)) { //Debug.Log("Rocket hit registered by GAManager"); Make(MyGameAsset.RocketExplosion, rH.location); int indexOfRocket = rockets_Active.IndexOf(rH.altRocket.gameObject); _StowActiveNonPhysicsManagedGO(rockets_Active, rockets_Times, rockets_Inactive, indexOfRocket); return; } } Event_LanceHit lH = e as Event_LanceHit; if (lH != null) { Make(MyGameAsset.LanceHit, lH.location); return; } Event_ExplosionBallHit x = e as Event_ExplosionBallHit; if (x != null) { Make(MyGameAsset.BulletExplosion, x.location); return; } Event_EnemyDeath eD = e as Event_EnemyDeath; if (eD != null) { //GameObject g = Make(MyGameAsset.DeathExplosion, eD.location); //g.GetComponent<Behavior_DeathExplosionTimer>().Explode(); GameObject g = Make(MyGameAsset.SFX, eD.location); g.GetComponent <AudioSource>().PlayOneShot(gameModel.sfx_EnemyLittleExplosion); } Event_EnemyMineHit m = e as Event_EnemyMineHit; if (m != null) { GameObject g = Make(MyGameAsset.MineExplosion, m.location); //g.GetComponent<Behavior_DeathExplosionParent>().Explode(); } Event_EnemyMissileHit msl = e as Event_EnemyMissileHit; if (msl != null) { GameObject g = Make(MyGameAsset.MissileExplosion, msl.location); } }