Пример #1
0
    /// <summary>
    /// Change the above information content, to shwo how many monster did player already seledted
    /// </summary>
    /// <param name="p1">Player One</param>
    public void ChangeInformation(ElementiaPlayer p1, ElementiaPlayer p2)
    {
        switch (p1.Monsters.Count)
        {
        case 0:
            InfoText.text = "Select Starting Monster";
            break;

        case 1:
            InfoText.text = "Select Monster Two";
            break;

        case 2:
            InfoText.text = "Select Monster Three";
            break;

        case 3:
            if (p2.Monsters.Count == 3)
            {
                InfoText.text = "Press Coin to Start";
            }
            else
            {
                InfoText.text = "Please waiting for Opponent to select monsters";
            }
            break;

        default:
            break;
        }
    }
Пример #2
0
    public void AddMonsterBtnPressed()
    {
        // get monster
        TrackableBehaviour tb;

        tb = GlobalValues.Instance.GetFirstTrackableImage();
        ElementiaMonster monster = GlobalValues.Instance.GetMonster(tb);

        // add monster for p1
        ElementiaPlayer p1 = GameObject.FindGameObjectWithTag("PlayerOne").GetComponent <ElementiaPlayer>();

        p1.Monsters.Add(monster);

        // synchronize p1 selected monster for p2
        PhotonView view = GameObject.FindGameObjectWithTag("RemoteController").GetComponent <PhotonView>();

        view.RPC("addMonsterForPlayerTwo", PhotonTargets.Others, monster.Name);

        // Change the above information content, to shwo how many monster did player already seledted
        ElementiaPlayer p2 = GameObject.FindGameObjectWithTag("PlayerTwo").GetComponent <ElementiaPlayer>();

        SelectMenuController.Instance.ChangeInformation(p1, p2);

        // show or hide add/remove monster btn
        SelectMenuController.Instance.SetBtnStatus();
    }
Пример #3
0
 private void Start()
 {
     p1 = GameObject.FindGameObjectWithTag("PlayerOne").GetComponent <ElementiaPlayer>();
     p2 = GameObject.FindGameObjectWithTag("PlayerTwo").GetComponent <ElementiaPlayer>();
     p1AttackMonster = p1.AttackMonster;
     p2AttackMonster = p2.AttackMonster;
     view            = GameObject.FindGameObjectWithTag("RemoteController").GetComponent <PhotonView>();
 }
Пример #4
0
    public void loadNewSceneAttackFirst()
    {
        PhotonView      view = GameObject.FindGameObjectWithTag("RemoteController").GetComponent <PhotonView>();
        ElementiaPlayer p1   = GameObject.FindGameObjectWithTag("PlayerOne").GetComponent <ElementiaPlayer>();

        // set which player is turn, and synchronize for  player two
        p1.IsMyTurn = true;

        // load new scene
        view.RPC("loadScene", PhotonTargets.All, "02_FightMenu");
    }
Пример #5
0
    void Start()
    {
        p1 = GameObject.FindGameObjectWithTag("PlayerOne").GetComponent <ElementiaPlayer>();
        p2 = GameObject.FindGameObjectWithTag("PlayerTwo").GetComponent <ElementiaPlayer>();

        AddBtn.gameObject.SetActive(true);
        RemoveBtn.gameObject.SetActive(false);

        CoinTossWinPanel.SetActive(false);
        CoinTossLosePanel.SetActive(false);
    }
Пример #6
0
    // remove previous monster
    public void RemoveMonsterBtnPressed()
    {
        DestroyCoinTossBtn();

        ElementiaPlayer p1   = GameObject.FindGameObjectWithTag("PlayerOne").GetComponent <ElementiaPlayer>();
        ElementiaPlayer p2   = GameObject.FindGameObjectWithTag("PlayerTwo").GetComponent <ElementiaPlayer>();
        PhotonView      view = GameObject.FindGameObjectWithTag("RemoteController").GetComponent <PhotonView>();

        p1.Monsters.RemoveAt(p1.Monsters.Count - 1);
        // synchronize
        view.RPC("removeMonsterForPlayerTwo", PhotonTargets.Others);

        // Change the above information content, to shwo how many monster did player already seledted
        SelectMenuController.Instance.ChangeInformation(p1, p2);

        // show or hide add/remove monster btn
        SelectMenuController.Instance.SetBtnStatus();
    }
Пример #7
0
    // reset UI elements
    void Start()
    {
        p1   = GameObject.FindGameObjectWithTag("PlayerOne").GetComponent <ElementiaPlayer>();
        p2   = GameObject.FindGameObjectWithTag("PlayerTwo").GetComponent <ElementiaPlayer>();
        view = GameObject.FindGameObjectWithTag("RemoteController").GetComponent <PhotonView>();

        IsMyTurn = p1.IsMyTurn;

        // show monsters
        GameObject monsters = GameObject.FindGameObjectWithTag("MonsterRoot").transform.Find("Monsters").gameObject;

        monsters.SetActive(true);

        InformationText.text = "";

        p1.AttackMonster = p1.Monsters[0];
        p2.AttackMonster = p2.Monsters[0];

        // calculate the start hp, if p1 pick monster first, he can't get monster hp at first
        if (p1.IsChangingMonster)
        {
            AttackBtn.gameObject.SetActive(false);
            ChangeMonsterBtn.gameObject.SetActive(false);
            ConformChangeMonsterBtn.gameObject.SetActive(true);
        }
        else // if pick monster fist, deactivate the attack/change monster button, and show the selecton button
        {
            p1.HP += p1.AttackMonster.HP;
            AttackBtn.gameObject.SetActive(IsMyTurn);
            ChangeMonsterBtn.gameObject.SetActive(IsMyTurn && (p1.RemainingMonsters > 0));
            ConformChangeMonsterBtn.gameObject.SetActive(false);
        }
        p2.HP += p2.AttackMonster.HP;

        p1.StartHp = p1.HP;
        p2.StartHp = p2.HP;
        RefreshUI();
    }
Пример #8
0
    /// <summary>
    /// the player hase choice selecte monster, not attack first
    /// </summary>
    public void chooseMonsterFirstBtnClicked()
    {
        // get player one and phton view
        ElementiaPlayer p1   = GameObject.FindGameObjectWithTag("PlayerOne").GetComponent <ElementiaPlayer>();
        PhotonView      view = GameObject.FindGameObjectWithTag("RemoteController").GetComponent <PhotonView>();

        p1.IsChangingMonster = true;
        p1.Monsters[0]       = new ElementiaDemoMonster(); // if select monster first, will don't get extra hp
        p1.AttackMonster     = p1.Monsters[0];
        //synchronize
        view.RPC("ChangeStartMonsters", PhotonTargets.Others, p1.AttackMonster.Name);

        // extra one exchange monsters
        p1.RemainingMonsters = 3;
        // synchronize
        view.RPC("SetRemainingMonsterForPlayerTwo", PhotonTargets.Others, p1.RemainingMonsters);

        // set which player is turn
        p1.IsMyTurn = true;

        // load new scene
        view.RPC("loadScene", PhotonTargets.All, "02_FightMenu");
    }
Пример #9
0
 private void Start()
 {
     p1 = GameObject.FindGameObjectWithTag("PlayerOne").GetComponent <ElementiaPlayer>();
     p2 = GameObject.FindGameObjectWithTag("PlayerTwo").GetComponent <ElementiaPlayer>();
 }
Пример #10
0
 void Start()
 {
     p1   = GameObject.FindGameObjectWithTag("PlayerOne").GetComponent <ElementiaPlayer>();
     view = GameObject.FindGameObjectWithTag("RemoteController").GetComponent <PhotonView>();
 }