Example #1
0
        public void Substitute()
        {
            var subbedPlayer     = Team.Players.Single(p => p.Number == SelectedNumber);
            var substitutePlayer = SelectedSubstitute;

            SubstitutedPlayers.Add(subbedPlayer);

            substitutePlayer.Location.XamlX = subbedPlayer.Location.XamlX;
            substitutePlayer.Location.XamlY = subbedPlayer.Location.XamlY;

            TeamFormation[TeamFormation.
                          Where(kvp => kvp.Value.Number == subbedPlayer.Number).
                          Select(kvp => kvp.Key).Single()] = substitutePlayer;

            UpdatePlayerShirts();

            PlayerNumbers.Remove(SelectedNumber);
            PlayerSubstitutes.Remove(substitutePlayer);

            NotifyOfPropertyChange(() => PlayerSubstitutes);
            NotifyOfPropertyChange(() => PlayerNumbers);

            SelectedNumber     = 0;
            SelectedSubstitute = null;

            ++SubstitutesUsed;
        }
Example #2
0
 public void SetMass(MassTypes massType, PlayerNumbers playerNumber)
 {
     if (
         !(massType is MassTypes.Void) &&
         playerNumber == this.speedController
         )
     {
         GetComponent <Rigidbody>().mass = massType == MassTypes.Heavy
             ? this.heavyMass
             : this.lightMass;
     }
 }
Example #3
0
        public override void Initialize(PlayerNumbers pNumber)
        {
            playerNumber = pNumber;

            client = GameObject.Find("Network").GetComponent <UnityClient>();

            mainCamera = GameObject.Find("Main Camera").GetComponent <Camera>();
            if (mainCamera == null)
            {
                Debug.LogError("mainCamera is not set, will cause errors");
            }
        }
Example #4
0
 public void ChangeTurn()
 {
     currentTurnPlayer.GetComponent <Player>().ToggleTurn();
     foreach (Transform child in transform)
     {
         currentTurnPlayer = child.gameObject;
         currentTurnPlayer.GetComponent <Player>().ToggleTurn();
         number = currentTurnPlayer.GetComponent <Player>().GetPlayerNumber();
         //currentTurnPlayer.GetComponent<Player>().GetPlayerNumber();
         child.SetAsLastSibling();
         break;
     }
 }
Example #5
0
        public void ShowWinner(PlayerNumbers player)
        {
            if (!CheckForWinnerTextGameObject())
            {
                return;
            }
            gameOverUI.SetActive(true);
            switch (player)
            {
            case PlayerNumbers.ONE:
            {
                winnerText.text  = redWinsText;
                winnerText.color = redWinsColor;
                break;
            }

            case PlayerNumbers.TWO:
            {
                winnerText.text  = blueWinsText;
                winnerText.color = blueWinsColor;
                break;
            }

            case PlayerNumbers.THREE:
            {
                Debug.LogError("Currently does not support three players");
                break;
            }

            case PlayerNumbers.FOUR:
            {
                Debug.LogError("Currently does not support four players");
                break;
            }

            default:
                Debug.LogError("PlayerNumbers is not valid");
                break;
            }
        }
Example #6
0
        public void ChangeColor(PlayerNumbers player)
        {
            switch (player)
            {
            case PlayerNumbers.ONE:
            {
                outline1.effectColor = outline3.effectColor = redColor;
                Color blah = new Color(redColor.r, redColor.g, redColor.b, 0.062f);
                Debug.Log(blah.r.ToString() + " " + blah.g.ToString() + " " + blah.b.ToString() + " " + blah.a.ToString());
                outline2.effectColor = blah;
                break;
            }

            case PlayerNumbers.TWO:
            {
                outline1.effectColor = outline3.effectColor = blueColor;
                Color blah = new Color(blueColor.r, blueColor.g, blueColor.b, 0.062f);
                Debug.Log(blah.r.ToString() + " " + blah.g.ToString() + " " + blah.b.ToString() + " " + blah.a.ToString());
                outline2.effectColor = blah;
                break;
            }

            case PlayerNumbers.THREE:
            {
                Debug.LogError("Three players not currently supported");
                break;
            }

            case PlayerNumbers.FOUR:
            {
                Debug.LogError("Four players not currently supported");
                break;
            }

            default:
                break;
            }
        }
Example #7
0
 public override void Initialize(PlayerNumbers pNumber)
 {
     //client = GameObject.Find("Network").GetComponent<UnityClient>();
 }
Example #8
0
 public static bool Action1Up(PlayerNumbers playerNumber)
 {
     return Action1Up((int) playerNumber);
 }
Example #9
0
 public static bool PauseDown(PlayerNumbers playerNumber)
 {
     return PauseDown((int) playerNumber);
 }
Example #10
0
 public static float LeftStickVertical(PlayerNumbers playerNumber)
 {
     return LeftStickVertical((int) playerNumber);
 }
Example #11
0
 public static float LeftStickHorizontal(PlayerNumbers playerNumber)
 {
     return LeftStickHorizontal((int) playerNumber);
 }
Example #12
0
 public static bool Action2Down(PlayerNumbers playerNumber)
 {
     return Action2Down((int) playerNumber);
 }
 public virtual void Initialize(PlayerNumbers pNumber)
 {
 }