Exemple #1
0
    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;
            }
        }
    }
Exemple #2
0
    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);
        }
    }