コード例 #1
0
ファイル: PlayerInput.cs プロジェクト: guyikcgg/Jamtoday-2018
 IEnumerator WaitForBadButtonAnimation(Enums.PlayerType type, float time)
 {
     for (float i = 0; i < time; i += Time.deltaTime)
     {
         yield return(0);
     }
     GenerateCombo(type);
 }
コード例 #2
0
        /// <summary>
        ///     Konstruktor. Wywołuje konstruktor bazowy.
        /// </summary>
        /// <param name="type">Typ gracza.</param>
        protected Player(Enums.PlayerType type)
        {
            ActualColumns.Add(0);
            ActualRows.Add(0);
            X         = Y = 0;
            _blinking = false;
            _dieTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromSeconds(3),
            };
            _dieTimer.Tick += DieTimer_Tick;

            switch (type)
            {
            case Enums.PlayerType.Agile:
                _speed = GameConst.PlayerSpeed;
                Fill   = CreateImageBrush(GameConst.PlayerAgile);
                break;

            case Enums.PlayerType.Fast:
                _speed = GameConst.FastSpeed;
                Fill   = CreateImageBrush(GameConst.PlayerFast);
                break;

            case Enums.PlayerType.Shy:
                _speed = GameConst.PlayerSpeed;
                Fill   = CreateImageBrush(GameConst.PlayerShy);
                break;
            }
            switch (Difficulty)
            {
            case Enums.LevelDifficulty.Easy:
                RemainingLifes = GameConst.EasyLifes;
                break;

            case Enums.LevelDifficulty.Medium:
                RemainingLifes = GameConst.MediumLifes;
                break;

            case Enums.LevelDifficulty.Hard:
                RemainingLifes = GameConst.HardLifes;
                break;
            }
            RemainingBombs = GameConst.BombCount;
            _firingRange   = GameConst.PlayerFiringRange;
            _scores        = 0;
            _actualBonuses = new List <Bonus>();

            StartTimer();

            _bombNotSetOrExploded = true;

            _bomb = new Bomb();
            GameParameters.ActualBomb = _bomb;
            _bomb.BombBoom           += Boom;
        }
コード例 #3
0
ファイル: Population.cs プロジェクト: guyikcgg/Jamtoday-2018
 public void DisableCanvas(Enums.PlayerType type)
 {
     if (type == Enums.PlayerType.fakeNews)
     {
         canvas[0].DisableButtons();
     }
     else
     {
         canvas[1].DisableButtons();
     }
 }
コード例 #4
0
ファイル: Population.cs プロジェクト: guyikcgg/Jamtoday-2018
 public void EnableCanvas(Enums.PlayerType type, int[] input)
 {
     if (type == Enums.PlayerType.fakeNews)
     {
         canvas[0].EnableButtons(input);
     }
     else
     {
         canvas[1].EnableButtons(input);
     }
 }
コード例 #5
0
ファイル: Population.cs プロジェクト: guyikcgg/Jamtoday-2018
    public void AddPercentage(Enums.PlayerType type)
    {
        if (fakePercentage + truthPercentage >= 100)
        {
            if (type == Enums.PlayerType.fakeNews)
            {
                fakePercentage  += increment;
                truthPercentage -= increment;
            }
            else if (type == Enums.PlayerType.truthNews)
            {
                fakePercentage  -= increment;
                truthPercentage += increment;
            }
        }
        else
        {
            if (type == Enums.PlayerType.fakeNews)
            {
                fakePercentage += increment;
            }
            else if (type == Enums.PlayerType.truthNews)
            {
                truthPercentage += increment;
            }
        }
        if (fakePercentage < 0)
        {
            fakePercentage = 0;
        }
        if (truthPercentage < 0)
        {
            truthPercentage = 0;
        }
        if (fakePercentage > 100)
        {
            fakePercentage = 100;
        }
        if (truthPercentage > 100)
        {
            truthPercentage = 100;
        }

        matchManager.UpdateSlider();
        UpdatePercentage();
    }
コード例 #6
0
    /// <summary>
    /// Sets the capturing party to the side with most players within the circle of influence
    /// </summary>
    private void SetCapturePointOwner()
    {
        int _disposition = GetPlayerDisposition();

        if (_disposition > 0)
        {
            // Ghosts
            mCapturingPlayerType = Enums.PlayerType.Ghost;
        }
        if (_disposition < 0)
        {
            // Hunters
            mCapturingPlayerType = Enums.PlayerType.Hunter;
        }
        else if (_disposition == 0)
        {
            mCapturingPlayerType = Enums.PlayerType.None;
        }
    }
コード例 #7
0
ファイル: Population.cs プロジェクト: guyikcgg/Jamtoday-2018
    public void DecreasePercentage(Enums.PlayerType type)
    {
        if (type == Enums.PlayerType.fakeNews)
        {
            fakePercentage -= increment;
        }
        else if (type == Enums.PlayerType.truthNews)
        {
            truthPercentage -= increment;
        }
        if (fakePercentage < 0)
        {
            fakePercentage = 0;
        }
        if (truthPercentage < 0)
        {
            truthPercentage = 0;
        }

        matchManager.UpdateSlider();
        UpdatePercentage();
    }
コード例 #8
0
 public Computer(Name name, Enums.PlayerType playerType, Vocabulary vocabulary) : base(name, playerType)
 {
     Vocabulary = vocabulary;
     Random     = new Random();
 }
コード例 #9
0
ファイル: PlayerInput.cs プロジェクト: guyikcgg/Jamtoday-2018
    private void CheckCombo(Enums.PlayerType type, int input)
    {
        if (Enums.PlayerType.fakeNews == type)
        {
            if (comboFake == null || comboFake.Length <= indexFake)
            {
                return;
            }
            if (comboFake[indexFake] == input)
            {
                indexFake++;
                for (int i = 0; i < 8; i += 2)
                {
                    canvas[i].TickButton();
                }
                if (comboFake.Length == indexFake)
                {
                    // Combo was successfully entered [fake]
                    activePopulation[0].AddPercentage(type);
                    GenerateCombo(type);
                }
            }
            else
            {
                for (int i = 0; i < 8; i += 2)
                {
                    canvas[i].BadButton();
                }
                StartCoroutine(WaitForBadButtonAnimation(type, 0.3f));
            }
        }

        else
        {
            if (comboTruth == null || comboTruth.Length <= indexTruth)
            {
                return;
            }
            if (comboTruth[indexTruth] == input)
            {
                indexTruth++;
                for (int i = 1; i < 8; i += 2)
                {
                    canvas[i].TickButton();
                }
                if (comboTruth.Length == indexTruth)
                {
                    // Combo was successfully entered [truth]
                    activePopulation[1].AddPercentage(type);
                    GenerateCombo(type);
                }
            }
            else
            {
                for (int i = 1; i < 8; i += 2)
                {
                    canvas[i].BadButton();
                }
                StartCoroutine(WaitForBadButtonAnimation(type, 0.2f));
            }
        }
    }
コード例 #10
0
ファイル: PlayerInput.cs プロジェクト: guyikcgg/Jamtoday-2018
    private void GenerateCombo(Enums.PlayerType type)
    {
        int type2 = -1;

        if (type == Enums.PlayerType.fakeNews)
        {
            type2 = 0;
        }
        else
        {
            type2 = 1;
        }

        int length = activePopulation[type2].comboLength;
        int random;

        if (type2 == 0)
        {
            comboFake = new int[length];
            indexFake = 0;
        }

        else
        {
            comboTruth = new int[length];
            indexTruth = 0;
        }

        for (int i = 0; i < length; i++)
        {
            random = Random.Range(0, 4);
            if (type2 == 0)
            {
                comboFake[i] = random;
            }
            else
            {
                comboTruth[i] = random;
            }
        }

        if (type2 == 0)
        {
            activePopulation[0].EnableCanvas(Enums.PlayerType.fakeNews, comboFake);
            for (int i = 0; i < populations.Length; i++)
            {
                if (activePopulation[0] != populations[i])
                {
                    populations[i].DisableCanvas(Enums.PlayerType.fakeNews);
                }
            }
        }

        else
        {
            activePopulation[1].EnableCanvas(Enums.PlayerType.truthNews, comboTruth);
            for (int i = 0; i < populations.Length; i++)
            {
                if (activePopulation[1] != populations[i])
                {
                    populations[i].DisableCanvas(Enums.PlayerType.truthNews);
                }
            }
        }
    }