Example #1
0
    string UpdateServer_DEAD(SmartMonster smartMonster)
    {
        // events sorted by priority (e.g. target doesn't matter if we died)
        if (EventRespawnTimeElapsed(smartMonster))
        {
            // respawn at the start position with full health, visibility, no loot
            smartMonster.gold = 0;
            smartMonster.inventory.slots.Clear();
            smartMonster.Show();
            smartMonster.movement.Warp(smartMonster.startPosition); // recommended over transform.position
            smartMonster.Revive();
            return("IDLE");
        }
        if (EventDeathTimeElapsed(smartMonster))
        {
            // we were lying around dead for long enough now.
            // hide while respawning, or disappear forever
            if (smartMonster.respawn)
            {
                smartMonster.Hide();
            }
            else
            {
                NetworkServer.Destroy(smartMonster.gameObject);
            }
            return("DEAD");
        }
        if (EventSkillRequest(smartMonster))
        {
        }                                        // don't care
        if (EventSkillFinished(smartMonster))
        {
        }                                         // don't care
        if (EventMoveEnd(smartMonster))
        {
        }                                   // don't care
        if (EventTargetDisappeared(smartMonster))
        {
        }                                             // don't care
        if (EventTargetDied(smartMonster))
        {
        }                                      // don't care
        if (EventTargetTooFarToFollow(smartMonster))
        {
        }                                                // don't care
        if (EventTargetTooFarToAttack(smartMonster))
        {
        }                                                // don't care
        if (EventTargetEnteredSafeZone(smartMonster))
        {
        }                                                 // don't care
        if (EventAggro(smartMonster))
        {
        }                                 // don't care
        if (EventMoveRandomly(smartMonster))
        {
        }                                        // don't care
        if (EventStunned(smartMonster))
        {
        }                                   // don't care
        if (EventDied(smartMonster))
        {
        }               // don't care, of course we are dead

        return("DEAD"); // nothing interesting happened
    }