void Awake()
 {
     // Debug.LogError("I SHOULD BE FIRST");
     // Set singleton
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
Пример #2
0
    void CmdPlayerConnected()
    {
        // Exits if not the server
        if (!isServer)
        {
            return;
        }

        // Retrieves an ID from GameManager
        int newID = GameManager_Networked.Instance().ClientConnected();

        // Updates all instances of this Player across clients
        RpcPlayerConnected(newID);
    }
Пример #3
0
    void CmdTrackDeath(int killerID, int playerID, WeaponType weaponType)
    {
        if (!isServer)
        {
            return;
        }

        GameManager_Networked.Instance().TrackDeath(killerID, playerID, weaponType);

        // Resets the last attacker and type
        player.SetLastAttackedID(player.GetPlayerID());
        player.SetLastAttackedType(WeaponType.none);
        //lastAttackedID = player.GetLastAttackedID();
        //lastAttackedType
    }
Пример #4
0
    protected void Start()
    {
        if (isLocalPlayer)
        {
            GameManager_Networked.Instance().gameManager.localPlayers[0] = player;
        }

        // Tells the server that the Player is connected
        CmdPlayerConnected();

        // If a copy of the Player on a client, freeze
        if (!isLocalPlayer)
        {
            player.FreezeConstraints();
        }

        // If UI exists (only local player), connect health bar and weapon UI
        if (player.GetUIManager())
        {
            player.GetUIManager().ui_Players[0].UpdateHealthBar(player.GetCurrHealth() / player.maxHealth);
            player.GetUIManager().ui_Players[0].UpdateWeaponIcons(playerID);
        }
    }