Exemplo n.º 1
0
        private void CreatePlayer(byte[] data)
        {
            var i = BitConverter.ToInt32(data, 0);

            OnPlayerCreated?.Invoke(i);
            Server.WriteLine($"Player created with ID: {i}");
        }
Exemplo n.º 2
0
        public override void Register(Owner owner)
        {
            base.Register(owner);

            owner.Resources = (InternalResources)PlayerStartingResources.Clone();
            OnPlayerCreated?.Invoke(owner);
        }
Exemplo n.º 3
0
        public void AddOrUpdatePlayer(Player player)
        {
            var existing = Players.FirstOrDefault((p) => p.Id == player.Id);

            if (existing != null)
            {
                existing.Name = player.Name;
                OnPlayerUpdated?.Invoke(
                    this,
                    new PlayerEventArgs {
                    EventType = "player-updated", Player = existing
                }
                    );
            }
            else
            {
                player.Score = 0;
                Players.Add(player);
                OnPlayerCreated?.Invoke(
                    this,
                    new PlayerEventArgs {
                    EventType = "player-created", Player = player
                }
                    );
            }
        }
Exemplo n.º 4
0
            public T CreatePlayer <T>(string playerName, int controllerId) where T : PinouPlayer, new()
            {
                T newPlayer = new T();

                newPlayer.Construct(GetFirstPlayerIDAvailable(), playerName, controllerId);

                _players.Add(newPlayer);
                OnPlayerCreated.Invoke(newPlayer);
                return(newPlayer);
            }
Exemplo n.º 5
0
    //Creates a player from a prefab and spawns a ship, starting characters and adds them to controllers
    private void CreateHumanPlayer()
    {
        Ship newShip = Instantiate(playerStarterShip);

        newShip.transform.SetParent(shipTransform);

        worldGrid.AddUnit(newShip, worldController.PlayerSpawnPosition, HexDirectionExtension.ReturnRandomDirection(), true);

        combatSystem.managementMap = playerStartingGridMap;

        Player newPlayer = new Player(newShip, true, playerCrewSimulation);

        MapTurnSystem.instance.AddPlayerToFirstPositionInTurnOrder(newPlayer);
        HexGridController.player = newPlayer;
        newPlayer.PlayerData.NextBountyChange = setupData.difficultySettings.bountyChanges;
        for (int i = 0; i < startingCharacters.Length; i++)
        {
            HexGridController.SpawnCharacterForPlayerCrew(startingCharacters[i]);
        }
        OnPlayerCreated?.Invoke(newPlayer);
    }
            public virtual void RegisterEntity(Entity ent)
            {
                SubscribeToEntityEvents(ent);

                switch (ent.Team)
                {
                case EntityTeam.Players:
                    players.Add(ent);
                    OnPlayerCreated.Invoke(ent);
                    break;

                case EntityTeam.Allies:
                    allies.Add(ent);
                    break;

                case EntityTeam.Enemies:
                    enemies.Add(ent);
                    OnEnemyCreated.Invoke(ent);
                    break;
                }
                OnEntityCreated.Invoke(ent);
            }
Exemplo n.º 7
0
 void Awake()
 {
     Initialize();
     OnPlayerCreated?.Invoke(this);
 }
Exemplo n.º 8
0
 void Start()
 {
     OnPlayerCreated?.Invoke();
 }
Exemplo n.º 9
0
 public void InvokePlayerCreated(GunClasses gunClass)
 {
     OnPlayerCreated?.Invoke(gunClass);
 }