Beispiel #1
0
    /// <summary>
    /// Called to respawn this craft to its spawn point
    /// </summary>
    public virtual void Respawn()
    {
        // no longer dead, busy or immobile
        isDead = false;
        isBusy = false;

        // Deactivate abilities
        foreach (var ability in abilities)
        {
            if (ability is ActiveAbility)
            {
                ActiveAbility aa = (ability as ActiveAbility);
                if (aa.TrueActive)
                {
                    aa.Deactivate();
                }
            }
        }
        transform.rotation = Quaternion.identity; // reset rotation so part rotation can be reset
        foreach (Transform child in transform)    // reset all the children rotations
        {
            child.transform.rotation      = Quaternion.identity;
            child.transform.localPosition = Vector3.zero;
            var tmp = child.gameObject.GetComponent <ShellPart>();
            // will be changed to check for all parts instead of just shell part
            if (tmp)         // if part exists
            {
                tmp.Start(); // initialize it
            }
        }

        Start(); // once everything else is done initialize the craft again
        AudioManager.PlayClipByID("clip_respawn", transform.position);
    }