public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0UL)
            {
                hash ^= Id.GetHashCode();
            }
            if (PlayerCount != 0)
            {
                hash ^= PlayerCount.GetHashCode();
            }
            if (PlayerMax != 0)
            {
                hash ^= PlayerMax.GetHashCode();
            }
            if (State != 0)
            {
                hash ^= State.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            return(hash);
        }
Exemple #2
0
    void Awake()
    {
        soundManager         = FindObjectOfType <SoundManager>();
        crowEnemyAI          = this.gameObject.GetComponent <CrowEnemy_AI>();
        animationComponent   = this.gameObject.transform.GetComponentInChildren <SkeletonEnemy_Animation>();
        pathfindingComponent = this.gameObject.transform.GetComponentInChildren <CrowEnemyAIPathfinding>();

        if (this.gameObject.transform.GetChild(0) != null)
        {
            spriteRenderer = this.gameObject.transform.GetChild(0).GetComponent <SpriteRenderer>();
        }

        waveManager = FindObjectOfType <WaveManager>();
        waveManager.AddActiveEnemy(this.gameObject);
        quirkManager = FindObjectOfType <QuirkManager>();
        playerCount  = FindObjectOfType <PlayerCount>();

        InitialiseClassInstance();

        if (quirkManager.CurrentQuirk.quirkID == 3)
        {
            int chosenModifier = quirkManager.RandomiseMSModifier();
            if (chosenModifier == 0)
            {
                basicEnemyClass.currentMovementSpeed = (basicEnemyClass.currentMovementSpeed / 2);
            }
            if (chosenModifier == 1)
            {
                basicEnemyClass.currentMovementSpeed = (basicEnemyClass.currentMovementSpeed * 2);
            }
        }
    }
Exemple #3
0
 public void SetupBoard(PlayerCount playerCount, List <Noble> nobles, List <Development> developments)
 {
     LoadDecks(nobles, developments);
     ShuffleAllDecks();
     DrawInitialBoardDevelopments();
     DrawNobles((uint)playerCount);
     InitTokens(playerCount);
 }
Exemple #4
0
 void Awake()
 {
     playerMovement = GetComponent <PlayerMovement>();
     playerCount    = FindObjectOfType <PlayerCount>();
     playerCombat   = FindObjectOfType <PlayerCombat>();
     animator       = GetComponentInChildren <Animator>();
     potCount       = startingPotCount;
     soundManager   = FindObjectOfType <SoundManager>();
 }
Exemple #5
0
        public void ComputeWinnerTest()
        {
            int         sideLength  = 3;
            PlayerCount playerCount = PlayerCount.Two;
            Matrix      target      = new Matrix(sideLength, playerCount);
            Player      expected    = new Player();
            Player      actual;

            actual = target.ComputeWinner();
            Assert.AreEqual(expected, actual);
        }
Exemple #6
0
 private void Awake()
 {
     ChoseNextRoom();
     screenFadeHandler = FindObjectOfType <ScreenFadeHandler>();
     quirkPickerUI     = FindObjectOfType <QuirkPickerUI>();
     playerCount       = FindObjectOfType <PlayerCount>();
     enemySpawner      = FindObjectOfType <EnemySpawner>();
     quirkSpawner      = FindObjectOfType <QuirkSpawner>();
     currentRoom       = roomParent.transform.GetChild(0).gameObject;
     SetPlayerPosArray();
 }
Exemple #7
0
    private void Awake()
    {
        bossEnemy_AI = GetComponent <Boss_AI>();
        cameraShake  = FindObjectOfType <CameraShake>();
        soundManager = FindObjectOfType <SoundManager>();
        playerCount  = FindObjectOfType <PlayerCount>();

        InitialiseClassInstance();

        StartCoroutine(nameof(FadeInHealthbarUICoroutine));
    }
Exemple #8
0
        public Matrix(int sideLength, PlayerCount playerCount)
        {
            _playerCount = playerCount;
            _cells       = new List <Cell>();

            for (int i = 0; i < sideLength; i++)
            {
                for (int j = 0; j < sideLength; j++)
                {
                    _cells.Add(new Cell(i, j));
                }
            }
        }
Exemple #9
0
        private void CountStay(Player player)
        {
            StayCount++;
            PlayerCount currentItem = PlayerStayCount.SingleOrDefault(item => item.Player == player);

            if (currentItem == null)
            {
                PlayerStayCount.Add(new PlayerCount(player));
            }
            else
            {
                currentItem.Count++;
            }
        }
Exemple #10
0
    public static float GetValueForVerticalAxis(PlayerCount playerCount, PlayerName playerName)
    {
        switch (playerCount)
        {
        case PlayerCount.SINGLE_PLAYER_KEYBOARD:
            return(Input.GetAxis("VerticalPlayer"));

        case PlayerCount.TWO_PLAYER:
            return(Input.GetAxis("VerticalPlayer_" + (uint)playerName));

        default:
            return(0);
        }
    }
Exemple #11
0
        public void SimulateRandomGameTest()
        {
            int         sideLength  = 4;
            PlayerCount playerCount = PlayerCount.Two;
            Matrix      target      = new Matrix(sideLength, playerCount);

            target.SimulateRandomGame();

            foreach (var cell in target.Cells)
            {
                Assert.IsTrue(cell.GetPlayer() != Player.Draw);
            }
            Assert.IsTrue(target.PlayerCount == PlayerCount.Two);
        }
Exemple #12
0
 public int SwitchStringToInt(PlayerCount value)
 {
     if (value == PlayerCount.One)
     {
         return(1);
     }
     else if (value == PlayerCount.Two)
     {
         return(2);
     }
     else
     {
         return(4);
     }
 }
Exemple #13
0
    public static bool GetReloadButtonDownForPlayer(PlayerCount playerCount, PlayerName playerName)
    {
        switch (playerCount)
        {
        case PlayerCount.SINGLE_PLAYER_MOUSE:
        case PlayerCount.SINGLE_PLAYER_KEYBOARD:
            return(Input.GetButtonDown("Reload"));

        case PlayerCount.TWO_PLAYER:
            return(Input.GetButtonDown("Reload_" + (uint)playerName));

        default:
            return(false);
        }
    }
    void Awake()
    {
        sceneHandler  = FindObjectOfType <ScreenFadeHandler>();
        playerStats   = FindObjectOfType <PlayerStats>();
        playerCount   = FindObjectOfType <PlayerCount>();
        playerSpawner = FindObjectOfType <PlayerSpawner>();
        //playerCombat = FindObjectOfType<PlayerCombat>();
        playerInput = GetComponent <PlayerInput>();
        controls    = new PlayerInputMap();

        if (playerCount != null)
        {
            playerCount.AddPlayerInputManager(gameObject);
        }
    }
Exemple #15
0
        public static async Task Send(SocketUserMessage msg)
        {
            var username = msg.Author.Username;

            if (username.Contains("§"))
            {
                username = username.Split('§').LastOrDefault()?.Remove(0, 1);
            }

            await WebHook.SendEmbedHook("SkyFactory", msg.Author.GetAvatarUrl(), username, 16711680,
                                        "**left the server!**");

            Stats.StopPlaying(username);

            await PlayerCount.DelPlayer();
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Receiver != 0)
            {
                hash ^= Receiver.GetHashCode();
            }
            if (TargetReward != 0)
            {
                hash ^= TargetReward.GetHashCode();
            }
            if (Modifier != 0F)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Modifier);
            }
            if (bonusKindCase_ == BonusKindOneofCase.PlayerCount)
            {
                hash ^= PlayerCount.GetHashCode();
            }
            if (bonusKindCase_ == BonusKindOneofCase.FastCompletion)
            {
                hash ^= FastCompletion.GetHashCode();
            }
            if (bonusKindCase_ == BonusKindOneofCase.RuneLevel)
            {
                hash ^= RuneLevel.GetHashCode();
            }
            if (bonusKindCase_ == BonusKindOneofCase.DefeatedMobCount)
            {
                hash ^= DefeatedMobCount.GetHashCode();
            }
            if (bonusKindCase_ == BonusKindOneofCase.PlayerRatio)
            {
                hash ^= PlayerRatio.GetHashCode();
            }
            hash ^= (int)bonusKindCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public override void GetProperties(ObjectPropertyList list)
        {
            base.GetProperties(list);

            if (Game != null)
            {
                for (int i = 0; i < Game.Players.Count; i++)
                {
                    list.Add(1060658 + i, String.Format("{0}\t{1}", "Player" + (i + 1).ToString(), Game.Players[i].Player.Name));
                }
            }
            else
            {
                list.Add(1060659, String.Format("{0}\t{1}", "Roll Order", GetRollOrder()));
                list.Add(1060660, String.Format("{0}\t{1}", "Players", PlayerCount.ToString()));
            }
        }
Exemple #18
0
        private void InitTokens(PlayerCount playerCount)
        {
            switch (playerCount)
            {
            case PlayerCount.Four:
                _boardTokensInternal = new TokenCollection(7, 7, 7, 7, 7, 5);
                break;

            case PlayerCount.Three:
                _boardTokensInternal = new TokenCollection(5, 5, 5, 5, 5, 5);
                break;

            case PlayerCount.Two:
            default:
                _boardTokensInternal = new TokenCollection(4, 4, 4, 4, 4, 5);
                break;
            }
        }
        public uint GetPvELeaderboardCount(PvEModes pveMode, PlayerCount playerCount, int mapID, int month)
        {
            var url =
                $"{baseUrl}/api/leaderboards/pve-count/{(int) pveMode}/{(int) playerCount}/{mapID}/{month}";

            var webRequest = WebRequest.Create(url);

            webRequest.ContentType = "application/json; charset=utf-8";

            var    response = webRequest.GetResponse();
            string text;

            using (var sr = new StreamReader(response.GetResponseStream() !))
            {
                text = sr.ReadToEnd();
            }

            CheckBackendStatus(text);
            return((JObject.Parse(text).GetValue("count") ?? -1).Value <uint>());
        }
Exemple #20
0
    private void Start()
    {
        tempScoreDisplay = FindObjectOfType <TempScoreDisplay>();
        playerCount      = FindObjectOfType <PlayerCount>();
        dataManager      = FindObjectOfType <DataManager>();

        if (killFeed == null)
        {
            killFeed = GameObject.Find("KillFeed").GetComponent <Text>();
            if (killFeed == null)
            {
                Debug.LogError("Error! Couldn't find the KillFeed text in a canvas!");
            }
            else
            {
                Debug.LogWarning("Warning! KillFeed wasn't assigned before running! Please set it in the gamecontroller killfeed script");
            }
        }

        killFeed.transform.parent.GetComponent <Image>().enabled = false;
    }
Exemple #21
0
    // Start is called before the first frame update
    void Start()
    {
        ballManager      = gameObject.GetComponent <BallManager>();
        dataManager      = gameObject.GetComponent <DataManager>();
        playerCount      = gameObject.GetComponent <PlayerCount>();
        tempScoreDisplay = FindObjectOfType <TempScoreDisplay>();
        parentCanvas     = GameObject.FindWithTag("ParentCanvas").transform;
        startPhaseCanvas = parentCanvas.Find("StartPhaseCanvas").GetComponent <Canvas>();
        nameplateCanvas  = parentCanvas.Find("NameplateCanvas").GetComponent <Canvas>();

        GetComponent <Canvas>();
        Time.timeScale = 0f;
        gameStarted    = false;
        gameRunning    = false;
        gameEnded      = false;

        nameplatesEnabled = (PlayerPrefs.GetInt("nameplatesEnabled", 1) == 1) ? true : false;
        commandsEnabled   = (PlayerPrefs.GetInt("commandsEnabled", 1) == 1) ? true : false;

        topTwo = new string[2];
    }
Exemple #22
0
                public override int GetHashCode()
                {
                    int hash = 1;

                    if (ChamberTemplateGmtId.Length != 0)
                    {
                        hash ^= ChamberTemplateGmtId.GetHashCode();
                    }
                    if (PlayerCount != 0)
                    {
                        hash ^= PlayerCount.GetHashCode();
                    }
                    if (StartTimeMs != 0L)
                    {
                        hash ^= StartTimeMs.GetHashCode();
                    }
                    if (_unknownFields != null)
                    {
                        hash ^= _unknownFields.GetHashCode();
                    }
                    return(hash);
                }
                public override int GetHashCode()
                {
                    int hash = 1;

                    if (room_ != null)
                    {
                        hash ^= Room.GetHashCode();
                    }
                    if (PlayerCount != 0)
                    {
                        hash ^= PlayerCount.GetHashCode();
                    }
                    if (MaxPlayers != 0)
                    {
                        hash ^= MaxPlayers.GetHashCode();
                    }
                    if (_unknownFields != null)
                    {
                        hash ^= _unknownFields.GetHashCode();
                    }
                    return(hash);
                }
        public List <MatchInfo> GetPvELeaderboard(PvEModes pveMode, PlayerCount playerCount, int mapID, int month,
                                                  int page, int totalResults)
        {
            var url =
                $"{baseUrl}/api/leaderboards/pve/{(int) pveMode}/{(int) playerCount}/{mapID}/{month}/{page}/{totalResults}";

            var webRequest = WebRequest.Create(url);

            webRequest.ContentType = "application/json; charset=utf-8";

            var    response = webRequest.GetResponse();
            string text;

            using (var sr = new StreamReader(response.GetResponseStream() !))
            {
                text = sr.ReadToEnd();
            }

            CheckBackendStatus(text);
            var deserializeObject = JsonConvert.DeserializeObject <List <MatchInfo> >(text);

            return(deserializeObject);
        }
Exemple #25
0
    void Awake()
    {
        sceneHandler = FindObjectOfType <SceneHandler>();
        playerStats  = FindObjectOfType <PlayerStats>();
        playerCount  = FindObjectOfType <PlayerCount>();
        playerInput  = GetComponent <PlayerInput>();
        playerCombat = FindObjectOfType <PlayerCombat>();
        controls     = new PlayerInputMap();

        playerCount.AddPlayer(gameObject);

        // Creates an array of PlayerMovement scripts for each player
        var playerControllers = FindObjectsOfType <PlayerMovement>();
        var playerCombats     = FindObjectsOfType <PlayerCombat>();

        // Creates variable that holds the index of the player
        var index = playerInput.playerIndex;

        // Takes the first controller to give input and assigns it to index 0, continues till 4 players have joined with the final index "3"
        playerMovement = playerControllers.FirstOrDefault(m => m.GetPlayerIndex() == index);
        playerCombat   = playerCombats.FirstOrDefault(m => m.GetPlayerIndex() == index);
        Debug.Log(index);
    }
Exemple #26
0
        private async Task MainAsync()
        {
            if (!Directory.Exists("stats"))
            {
                Directory.CreateDirectory("stats");
            }

            if (!File.Exists("stats/players.txt"))
            {
                File.Create("stats/players.txt").Close();
            }

            _client = new DiscordSocketClient(new DiscordSocketConfig
            {
                LogLevel         = LogSeverity.Info,
                MessageCacheSize = 50
            });

            _client.Log += Log;

            _services = _map.BuildServiceProvider();

            await _commands.AddModulesAsync(Assembly.GetEntryAssembly());

            _client.MessageReceived       += HandleCommandAsync;
            _client.UserVoiceStateUpdated += HandleVoiceStateAsync;

            Config.ParseConfig();

            await _client.LoginAsync(TokenType.Bot, Config.DiscordToken);

            await _client.StartAsync();

            await PlayerCount.Update();

            await Task.Delay(-1);
        }
Exemple #27
0
 public static void AddPlayer(ClientInfo _cInfo)
 {
     if (!Teams.ContainsKey(_cInfo.playerId))
     {
         if (Teams.Count >= PlayerCount)
         {
             Phrases.Dict.TryGetValue(773, out string _phrase773);
             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase773 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             return;
         }
         EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         if (_player != null)
         {
             Vector3 _position  = _player.GetPosition();
             int     x          = (int)_position.x;
             int     y          = (int)_position.y;
             int     z          = (int)_position.z;
             string  _sposition = x + "," + y + "," + z;
             PersistentContainer.Instance.Players[_cInfo.playerId].EventReturnPosition = _sposition;
             PersistentContainer.Instance.Save();
             Phrases.Dict.TryGetValue(774, out string _phrase774);
             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase774 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
         EventCommandsConsole.Setup.TryGetValue(Operator, out List <string> _setup);
         Teams.Add(_cInfo.playerId, TeamSetup);
         Phrases.Dict.TryGetValue(775, out string _phrase775);
         _phrase775 = _phrase775.Replace("{Value}", TeamSetup.ToString());
         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase775 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         TeamSetup--;
         if (TeamSetup == 0)
         {
             TeamSetup = TeamCount;
         }
         if (Teams.Count == PlayerCount)
         {
             Invited = false;
             foreach (var _teamPlayer in Teams)
             {
                 ClientInfo _eventClientInfo = ConnectionManager.Instance.Clients.ForPlayerId(_teamPlayer.Key);
                 if (_eventClientInfo != null)
                 {
                     EntityPlayer _eventPlayer = GameManager.Instance.World.Players.dict[_eventClientInfo.entityId];
                     if (_eventPlayer != null && _eventPlayer.IsAlive())
                     {
                         Teams.TryGetValue(_teamPlayer.Key, out int _teamNumber);
                         string   _spawnPosition = _setup[_teamNumber + 4];
                         int      _x, _y, _z;
                         string[] _cords = _spawnPosition.Split(',');
                         int.TryParse(_cords[0], out _x);
                         int.TryParse(_cords[1], out _y);
                         int.TryParse(_cords[2], out _z);
                         _eventClientInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(_x, _y, _z), null, false));
                     }
                     else
                     {
                         PersistentContainer.Instance.Players[_eventClientInfo.playerId].EventSpawn = true;
                         PersistentContainer.Instance.Save();
                     }
                 }
                 else
                 {
                     PersistentContainer.Instance.Players[_eventClientInfo.playerId].EventSpawn = true;
                     PersistentContainer.Instance.Save();
                 }
             }
             int _eventTime = Time * 60;
             Timers._eventTime = _eventTime;
             Open = true;
             Phrases.Dict.TryGetValue(776, out string _phrase776);
             _phrase776 = _phrase776.Replace("{EventName}", TeamSetup.ToString());
             ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase776 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
         }
         else
         {
             Phrases.Dict.TryGetValue(777, out string _phrase777);
             _phrase777 = _phrase777.Replace("{EventName}", TeamSetup.ToString());
             _phrase777 = _phrase777.Replace("{CommandPrivate}", ChatHook.Command_Private);
             _phrase777 = _phrase777.Replace("{Command100}", Command100);
             ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase777 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
             Phrases.Dict.TryGetValue(778, out string _phrase778);
             _phrase778 = _phrase778.Replace("{Value}", Teams.Count.ToString());
             _phrase778 = _phrase778.Replace("{PlayerTotal}", PlayerCount.ToString());
             ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase778 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
         }
     }
     else
     {
         Phrases.Dict.TryGetValue(779, out string _phrase779);
         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase779 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
 }
Exemple #28
0
 void Awake()
 {
     playerCount  = FindObjectOfType <PlayerCount>();
     playerCombat = FindObjectOfType <PlayerCombat>();
 }
        public void MergeFrom(ChallengeBonus other)
        {
            if (other == null)
            {
                return;
            }
            if (other.Id.Length != 0)
            {
                Id = other.Id;
            }
            if (other.Receiver != 0)
            {
                Receiver = other.Receiver;
            }
            if (other.TargetReward != 0)
            {
                TargetReward = other.TargetReward;
            }
            if (other.Modifier != 0F)
            {
                Modifier = other.Modifier;
            }
            switch (other.BonusKindCase)
            {
            case BonusKindOneofCase.PlayerCount:
                if (PlayerCount == null)
                {
                    PlayerCount = new global::WUProtos.Data.Player.PlayerCountChallengeBonus();
                }
                PlayerCount.MergeFrom(other.PlayerCount);
                break;

            case BonusKindOneofCase.FastCompletion:
                if (FastCompletion == null)
                {
                    FastCompletion = new global::WUProtos.Data.FastCompletionChallengeBonus();
                }
                FastCompletion.MergeFrom(other.FastCompletion);
                break;

            case BonusKindOneofCase.RuneLevel:
                if (RuneLevel == null)
                {
                    RuneLevel = new global::WUProtos.Data.RuneLevelChallengeBonus();
                }
                RuneLevel.MergeFrom(other.RuneLevel);
                break;

            case BonusKindOneofCase.DefeatedMobCount:
                if (DefeatedMobCount == null)
                {
                    DefeatedMobCount = new global::WUProtos.Data.DefeatedMobCountChallengeBonus();
                }
                DefeatedMobCount.MergeFrom(other.DefeatedMobCount);
                break;

            case BonusKindOneofCase.PlayerRatio:
                if (PlayerRatio == null)
                {
                    PlayerRatio = new global::WUProtos.Data.Player.PlayerRatioChallengeBonus();
                }
                PlayerRatio.MergeFrom(other.PlayerRatio);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
Exemple #30
0
 public override string ToString()
 {
     return(PlayerCount.ToString() + " / " + MaxPlayers.ToString());
 }