예제 #1
0
    public void LegendCardG()
    {
        // Prince Thorald leaves the game
        GameObject found = GameObject.Find("Prince");

        if (found == null)
        {
            found = GameObject.Find("Prince(Clone)");
        }
        found.GetPhotonView().RPC("Destroy", RpcTarget.AllBuffered);
        // add wardarks on space 26 and 27 (move twice at the end of the day)
        Vector3 w26 = GameBoardRegion.getCoordinates(26);
        Vector3 w27 = GameBoardRegion.getCoordinates(27);
        Dictionary <int, Vector3> wPositions = new Dictionary <int, Vector3>()
        {
            { 26, w26 },
            { 27, w27 }
        };
        GameObject m;

        foreach (KeyValuePair <int, Vector3> w in wPositions)
        {
            m = (GameObject)PhotonNetwork.InstantiateSceneObject("Wardrak", w.Value, Quaternion.identity);
            SceneManager.MoveGameObjectToScene(m, SceneManager.GetSceneByName("GameScene"));
            PhotonView v3 = m.GetPhotonView();
            v3.RPC("DontDestroy", RpcTarget.AllBuffered);
            v3.RPC("SetPosition", RpcTarget.AllBuffered, w.Key);
        }
    }
예제 #2
0
    public void LegendCardC()
    {
        // hero rolls dice then add 50 to the number rolled & add skral on tower
        // 6 wp + [# heros X 10 - 10] sp
        // farmer on space 28
        Vector3    farmer28Coords = GameBoardRegion.getCoordinates(28);
        GameObject farmer         = (GameObject)PhotonNetwork.InstantiateSceneObject("FarmerToken", farmer28Coords, Quaternion.identity);

        SceneManager.MoveGameObjectToScene(farmer, SceneManager.GetSceneByName("GameScene"));
        PhotonView view = farmer.GetPhotonView();

        view.RPC("SetPosOfFarmer", RpcTarget.AllBuffered, 28);
        view.RPC("DontDestroy", RpcTarget.AllBuffered);

        // add gros on space 27& 31
        Vector3 gor27Coords = GameBoardRegion.getCoordinates(27);
        Vector3 gor31Coords = GameBoardRegion.getCoordinates(31);
        Dictionary <int, Vector3> gorPositions = new Dictionary <int, Vector3>()
        {
            { 27, gor27Coords },
            { 31, gor31Coords }
        };

        GameObject m;

        foreach (KeyValuePair <int, Vector3> gor in gorPositions)
        {
            m = (GameObject)PhotonNetwork.InstantiateSceneObject("Gor", gor.Value, Quaternion.identity);
            SceneManager.MoveGameObjectToScene(m, SceneManager.GetSceneByName("GameScene"));
            PhotonView v3 = m.GetPhotonView();
            v3.RPC("DontDestroy", RpcTarget.AllBuffered);
            v3.RPC("SetPosition", RpcTarget.AllBuffered, gor.Key);
        }

        // InstantiateMonsters();

        // add skrals on space 29 --> already there???
        Vector3 skrallVector = GameBoardRegion.getCoordinates(29);

        m = (GameObject)PhotonNetwork.InstantiateSceneObject("Skral", skrallVector, Quaternion.identity);
        SceneManager.MoveGameObjectToScene(m, SceneManager.GetSceneByName("GameScene"));
        PhotonView v4 = m.GetPhotonView();

        v4.RPC("DontDestroy", RpcTarget.AllBuffered);
        v4.RPC("SetPosition", RpcTarget.AllBuffered, 29);
        // add prince on space 27 (prince is +4 sp and can move up to 4 spaces in an hour)
        Vector3 princeVector = GameBoardRegion.getCoordinates(27);

        // MAKE SURE THAT THE NAME OF THE TOKEN IS CORRECT IN RESOURCE
        m = (GameObject)PhotonNetwork.InstantiateSceneObject("Prince", princeVector, Quaternion.identity);
        SceneManager.MoveGameObjectToScene(m, SceneManager.GetSceneByName("GameScene"));
        v4 = m.GetPhotonView();
        v4.RPC("DontDestroy", RpcTarget.AllBuffered);
        v4.RPC("SetPosOfPrince", RpcTarget.AllBuffered, 27);
    }
예제 #3
0
    public void updateRegion()
    {
        int newRegion = Graph.monsterGraph[this.pos];

        GameObject[] monsters       = GameObject.FindGameObjectsWithTag("Monster");
        bool         alreadyMonster = Array.Exists(monsters, m => m.GetComponent <Monster>().pos == newRegion && newRegion != 0);

        this.pos = newRegion;
        Vector3 newPos = GameBoardRegion.getCoordinates(newRegion);

        updatePos(newPos);
        if (alreadyMonster)
        {
            updateRegion();
        }
    }
예제 #4
0
 public void PlaceWitchToken(int location)
 {
     if (PhotonNetwork.IsMasterClient)
     {
         GameObject brew = (GameObject)PhotonNetwork.InstantiateSceneObject("WitchBrew", GameBoardRegion.getCoordinates(location), Quaternion.identity);
         PhotonView view = brew.GetPhotonView();
         view.RPC("SetPosOfBrew", RpcTarget.AllBuffered, (int)location);
         view.RPC("DontDestroy", RpcTarget.AllBuffered);
     }
 }
예제 #5
0
 public void DropGoldToken(int location)
 {
     if (PhotonNetwork.IsMasterClient)
     {
         GameObject gold = (GameObject)PhotonNetwork.InstantiateSceneObject("Gold", GameBoardRegion.getCoordinates(location), Quaternion.identity);
         PhotonView view = gold.GetPhotonView();
         view.RPC("SetPosOfGoldToken", RpcTarget.AllBuffered, (int)location);
         view.RPC("DontDestroy", RpcTarget.AllBuffered);
     }
 }