Example #1
0
    public void SpawnPlayer()
    {
        // Player is no longer dead
        b_IsDead = false;

        #region Weapons
        // Reset weapons in Weapon Manager
        this_WeaponManager.DisableAllPrimaryGuns();

        // Reset 'Weapons Picked Up' list.
        WeaponsPickedUp = new bool[8];

        // Turn off all weapon icons
        for (int i_ = 0; i_ < 8; ++i_)
        {
            this_WeaponManager.WeaponHUDSetWeaponActive(i_, false);
        }

        // Give the player a shotgun
        PickWeaponUp(WeaponList.Shotgun);

        // Set player weapons
        this_WeaponManager.ReadyForNextWeapon();
        this_WeaponManager.Weapon = WeaponList.Shotgun;  // Current
        #endregion

        #region Colliders and position
        // Turn off player collider
        gameObject.GetComponent <Collider>().enabled = true;

        // Turn off player mesh renderer
        gameObject.GetComponent <MeshRenderer>().enabled = true;

        GameObject spawnPoint = this_SystemManager.PlayerRequestsSpawn(TeamColor);

        // Set Position and Rotation
        this_GameObject.transform.position = spawnPoint.transform.position;
        this_GameObject.transform.rotation = spawnPoint.transform.rotation;

        // Enable weapons (models)
        go_WeaponObject.SetActive(true);
        this_CameraObject.transform.Find("Visors").gameObject.SetActive(true);

        // Reset camera rotation
        f_VertAngle = 0f;
        #endregion

        #region Health and Armor
        // Reset health and armor
        i_Health = i_Health_Max;
        i_Armor  = i_Armor_Max / 2;

        // Reset health (and armor, for now)
        this_HealthManager.SetHealthBar(1.0f);
        this_HealthManager.SetArmorBar(i_Armor, i_Armor_Max);
        #endregion
    }