コード例 #1
0
ファイル: Enemy.cs プロジェクト: tarsupin/Nexus
        public virtual bool Die(DeathResult deathResult)
        {
            // Delete the Enemy
            if (this.animate is Animate)
            {
                this.animate.DisableAnimation();
            }
            this.Destroy();

            // Replace with Particle

            // Knockout
            if (deathResult == DeathResult.Knockout)
            {
                DeathEmitter.Knockout(this.room, this.SpriteName, this.posX, this.posY);
            }

            // Standard Squish
            else if (deathResult == DeathResult.Squish)
            {
                //status.actionEnds = Systems.timer.Frame + 25;

                // Lock the enemy in position. Since it's .activity is now set to NoCollide, it won't change its position.
                physics.SetGravity(FInt.Create(0));
                physics.velocity.X = FInt.Create(0);
                physics.velocity.Y = FInt.Create(0);
            }

            // Disappear - No Additional Behaviors Needed
            //else if(deathResult == DeathResult.Disappear) {}

            return(true);
        }
コード例 #2
0
ファイル: BattleFight.cs プロジェクト: BenjixD/ProjectMooks
 private void CheckIfAnyEntityDied(FightResult result, ActionBase action)
 {
     foreach (var damageReceiver in result.receivers)
     {
         if (damageReceiver.fighter.stats.hp.GetValue() <= 0)
         {
             DeathResult deathResult = new DeathResult(result.fighter, damageReceiver, action);
             Messenger.Broadcast <DeathResult>(Messages.OnEntityDeath, deathResult);
         }
     }
 }
コード例 #3
0
    private void OnHeroDeath(DeathResult result)
    {
        List <PlayerObject> allPlayers = GameManager.Instance.battleComponents.field.GetActivePlayerObjects();

        PlayerObject heroPlayer = GameManager.Instance.battleComponents.field.GetHeroPlayer();

        heroPlayer.ApplyHeroDeathModifiers();

        StatusAilment reviveStatusAilmentPrefab = GameManager.Instance.models.GetCommonStatusAilment("Hero's Miracle");

        heroPlayer.ailmentController.AddStatusAilment(Instantiate(reviveStatusAilmentPrefab));
    }
コード例 #4
0
    private void OnEntityDeath(DeathResult result)
    {
        FightingEntity deadFighter = result.deadEntity.fighter;

        GameManager.Instance.time.GetController().StartCoroutine(deadFighter.Die());

        bool isEnemy = deadFighter.isEnemy();

        if (isEnemy)
        {
            GameManager.Instance.gameState.enemyParty.SetFighter(deadFighter.targetId, null);

            bool          stillHasEnemies = false;
            EnemyObject[] enemies         = GameManager.Instance.battleComponents.field.GetEnemyObjects();
            for (int i = 0; i < enemies.Length; i++)
            {
                if (enemies[i] != null)
                {
                    stillHasEnemies = true;
                    break;
                }
            }

            if (!stillHasEnemies)
            {
                OnWaveComplete();
            }
        }
        else
        {
            if (deadFighter.targetId == 0)
            {
                OnHeroDeath(result);
            }
            else
            {
                GameManager.Instance.gameState.playerParty.EvictPlayer(deadFighter.targetId, true);
            }
        }

        GameManager.Instance.battleComponents.ui.statusBarsUI.UpdateStatusBars();

        // Note: How we determine this part may change depending on how we do Mook deaths:
        List <PlayerObject> allPlayers = GameManager.Instance.battleComponents.field.GetActivePlayerObjects();

        if (allPlayers.Count == 1 && GameManager.Instance.battleComponents.field.GetHeroPlayer().HasModifier(ModifierAilment.MODIFIER_DEATH))
        {
            GameManager.Instance.battleComponents.stageController.LoadDeathScene();
        }
    }
コード例 #5
0
ファイル: Snail.cs プロジェクト: tarsupin/Nexus
        public override bool Die(DeathResult deathType)
        {
            // Knockouts and TNT can still occur, but squishing will cause other behaviors.
            if (deathType == DeathResult.Knockout)
            {
                return(base.Die(deathType));
            }

            this.Destroy();

            // TODO HIGH PRIORITY: Uncomment once "Shell" item is created.
            // Create Shell In Snail's Place
            //Shell shell = new Shell(this.scene, ShellSubType.Red, this.posX, this.posY);
            //this.scene.AddToObjects(shell);

            return(true);
        }
コード例 #6
0
ファイル: Turtle.cs プロジェクト: tarsupin/Nexus
        public override bool Die(DeathResult deathType)
        {
            // Knockouts and TNT can still occur, but squishing will cause other behaviors.
            if (deathType == DeathResult.Knockout)
            {
                return(base.Die(deathType));
            }

            this.Destroy();

            // Create Shell In Turtle's Place
            Shell shell = new Shell(this.room, (byte)ShellSubType.Red, FVector.Create(this.posX, this.posY), null);

            room.AddToScene(shell, true);

            return(true);
        }
コード例 #7
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.K))
        {
            List <EnemyObject> enemies = this.GetActiveEnemyObjects();
            foreach (EnemyObject enemy in enemies)
            {
                enemy.stats.hp.SetValue(0);
                DeathResult deathResult = new DeathResult(enemy, new DamageReceiver(enemy, enemy.stats, enemy.stats), null);
                Messenger.Broadcast <DeathResult>(Messages.OnEntityDeath, deathResult);
            }
        }

        if (Input.GetKeyDown(KeyCode.O))
        {
            FightingEntity hero = this.GetHeroPlayer();
            hero.stats.hp.SetValue(0);
            DeathResult deathResult = new DeathResult(hero, new DamageReceiver(hero, hero.stats, hero.stats), null);
            Messenger.Broadcast <DeathResult>(Messages.OnEntityDeath, deathResult);
        }
    }