Exemple #1
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, 65280,
                                        "**joined the server!**");

            Stats.AddPlayer(username);

            Stats.StartPlaying(username);

            await PlayerCount.AddPlayer();
        }
Exemple #2
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 #3
0
 void AddToPlayerList()
 {
     playerCount.AddPlayer(gameObject);
 }