Beispiel #1
0
    public int TryDestroyHazard(PlayerID player)
    {
        if (player == hazardOwner)
        {
            return(-1);
        }

        bool generatePowerUp = UnityEngine.Random.Range(0f, 1f) > 0.95f;
        int  powerUp         = UnityEngine.Random.Range(0, powerUps.Count);

        if (DataUtility.gameData.isNetworkedGame)
        {
            PunTools.PhotonRPC(view, "RPC_TryDestroyHazard", RpcTarget.AllBuffered, player, generatePowerUp, powerUp);
            return(HazardLevel);
        }
        else
        {
            if (generatePowerUp)
            {
                Instantiate(powerUps[powerUp], transform.position, Quaternion.identity);
            }
            gameObject.SetActive(false);
            spawner.HazardDestroyed(HazardLevel, transform.position, player, this);
            spawner.Return(this);
            return(HazardLevel);
        }
    }
Beispiel #2
0
 public void Throw(bool left, PlayerID owner)
 {
     if (DataUtility.gameData.isNetworkedGame)
     {
         PunTools.PhotonRPC(view, "RPC_ThrowHazard", RpcTarget.AllBuffered, left, owner, transform.position);
     }
     else
     {
         ThrowInternal(left, owner, transform.position);
     }
 }
Beispiel #3
0
 public void DestroyHazard()
 {
     if (DataUtility.gameData.isNetworkedGame)
     {
         PunTools.PhotonRPC(view, "RPC_DestroyHazard", RpcTarget.AllBuffered);
     }
     else
     {
         spawner.Return(this);
     }
 }