Exemplo n.º 1
0
    void CheckCollision(Collider2D coll)
    {
        Player     myPlayer = tankEvolution.GetComponent <PlayerGO>().myPlayer;
        PhotonView myPV     = tankEvolution.GetComponent <TankRPC>().myPV;

        Tag tag = TagsManager.FindTagEnum(coll.gameObject.tag);

        switch (tag)
        {
        case Tag.PlayerSpawn:
            if (myPlayer.Dynamit < 3)
            {
                myPlayer.Dynamit += 1;
                //myPV.RPC("SetItemPositionRPC", PhotonTargets.AllBuffered, coll.gameObject.GetComponent<PhotonView>().viewID, ItemManager.RandomPos());
            }
            break;

        case Tag.RepairDevice:
            if (myPlayer.Naprawiarka < 3)
            {
                myPlayer.Naprawiarka += 1;
                //myPV.RPC("SetItemPositionRPC", PhotonTargets.AllBuffered, coll.gameObject.GetComponent<PhotonView>().viewID, ItemManager.RandomPos());
            }
            break;

        case Tag.Resources:
            if (myPlayer.Zasoby < 3)
            {
                myPlayer.Zasoby += 1;
            }
            break;

        case Tag.Coin:
            coll.GetComponent <Gold>().GiveRevard(myPlayer);
            //myPV.RPC("SetItemPositionRPC", PhotonTargets.AllBuffered, coll.gameObject.GetComponent<PhotonView>().viewID, ItemManager.RandomPos());
            break;

        case Tag.Score:
            if (myPlayer.score < HUDManager.tempGranicaWbicjaLewla)
            {
                myPlayer.score += 50;
                //myPV.RPC("SetItemPositionRPC", PhotonTargets.AllBuffered, coll.gameObject.GetComponent<PhotonView>().viewID, ItemManager.RandomPos());
            }
            break;
        }
    }