public void StartSpawn(ServerPlayer player, MsgAlive spawnRequest) { MsgAlive spawnPostion = new MsgAlive(); spawnPostion.IsSpawn = false; // TODO, run a thread task to find a spawn. bool ret = false; if (ComputeSpawn != null) { ret = ComputeSpawn(player, World, ref player.Info.LastSpawnState.Position, ref player.Info.LastSpawnState.Azimuth); } if (ret) { player.Info.Alive = true; PlayerSpawned?.Invoke(this, player); spawnPostion.PlayerID = player.PlayerID; spawnPostion.Position = player.Info.LastSpawnState.Position; spawnPostion.Azimuth = player.Info.LastSpawnState.Azimuth; SendToAll(spawnPostion, false); } }
internal static void OnPlayerSpawned(Player player) { PlayerSpawned?.Invoke(player, new PlayerEventArgs() { Player = player }); }
private void Start() { GameObject player = Instantiate(_playerData.Prefab, _point.position, Quaternion.identity); player.GetComponent <PlayerWeapons>().Current.Construct(); player.GetComponent <PlayerAnimator>().Construct(); PlayerSpawned?.Invoke(player); }
private void Spawn() { _astronaut = Instantiate(_astronautPrefab, transform); _astronaut.Died += OnDied; _astronaut.Despawned += OnDespawned; PlayerSpawned?.Invoke(this); }
protected override void DispatchPlayerOnSpawnRequest(FrostbiteConnection sender, Packet cpRequestPacket) { if (cpRequestPacket.Words.Count >= 9) { if (PlayerSpawned != null) { FrostbiteConnection.RaiseEvent(PlayerSpawned.GetInvocationList(), this, cpRequestPacket.Words[1], cpRequestPacket.Words[2], cpRequestPacket.Words.GetRange(3, 3), cpRequestPacket.Words.GetRange(6, 3)); // new Inventory(cpRequestPacket.Words[3], cpRequestPacket.Words[4], cpRequestPacket.Words[5], cpRequestPacket.Words[6], cpRequestPacket.Words[7], cpRequestPacket.Words[8])); } } }
public override Character Spawn() { var character = base.Spawn(); foreach (var muzzleRegulation in this.muzzleRegulations) { muzzleRegulation.Instantiate(character); } Instantiate(this.cameraController); Broker.Global.Publish(PlayerSpawned.Get(character)); return(character); }
/// <summary> /// Spawn a new player at start position /// </summary> public Player SpawnPlayer(Vector3 spawnPosition) { //Debug.Log("Spawn Player"); // if there's already a player, remove it if (_player != null) { RemoveExistingPlayer(); } _player = Instantiate(_playerPrefab, spawnPosition, Quaternion.identity); //TODO look into a way to pass this information before instantiating (it calls awake before initialize) _player.Initialize(_levelController.GameplayInput); _player.Health.Died.AddListener(OnPlayerDied); PlayerSpawned?.Invoke(_player); _cameraController.PlayerCamera.Follow = _player.transform; return(_player); }
public void HandleAlive(NetworkMessage msg) { MsgAlive alive = msg as MsgAlive; Player player = GetPlayerByID(alive.PlayerID); if (player == null) { return; } player.Active = true; player.PlayerSpawnTime = Clock.StepTime; player.SetTeleport(-1, null, null); player.Spawn(alive.Position, alive.Azimuth); if (alive.PlayerID == LocalPlayerID) { SelfSpawned?.Invoke(this, player); } PlayerSpawned?.Invoke(this, player); }
private void RegisterOpponent(PlayerSpawned playerSpawned) { this.CurrentPlayerOpponent.OnNext(new CurrentPlayerOpponent(this.Player, playerSpawned.Player)); }
public override void PopulateSlot(PlayerSpawned playerSpanwed) { base.PopulateSlot(playerSpanwed); }
private void OnPlayerSpawned(PlayerSpawned packet, NebulaConnection conn) { packet.PlayerId = conn.Id; SendPacketToOthers(conn.Id, packet, DeliveryMethod.ReliableOrdered); }
public override void PopulateSlot(PlayerSpawned playerSpanwed) { base.PopulateSlot(playerSpanwed); _dressControl = playerSpanwed.player.GetComponent<DressController>(); }
void SpawnPlayer() { PlayerSpawned?.Invoke(_playerSpawnPoints[Random.Range(0, _playerSpawnPoints.Count - 1)].SpawnPlayer()); }
private void Spawn() { if (PlayerPrefs.GetInt("Checkpoint") == 1) { Vector3 position1 = new Vector3(spawn1.transform.position.x, spawn1.transform.position.y, spawn1.transform.position.z); GameObject PlayerSpawned; if (PlayerPrefs.GetInt("GodmodeActivated") == 1) { //godmodeAttiva PlayerSpawned = Instantiate(playerDisarmatoGOD, position1, spawn1.transform.rotation); } else { //GodmodeDisattiva PlayerSpawned = Instantiate(playerDisarmato, position1, spawn1.transform.rotation); } //reset score ScoreController scoreController = PlayerSpawned.GetComponent <ScoreController>(); if (PlayerPrefs.GetInt("PlayerTotalScore") != 0) { PlayerPrefs.SetInt("PlayerTotalScore", 0); PlayerPrefs.Save(); } scoreController.SetTotalScore(PlayerPrefs.GetInt("PlayerTotalScore")); } if (PlayerPrefs.GetInt("Checkpoint") == 2) { Vector3 position2 = new Vector3(spawn2.transform.position.x, spawn2.transform.position.y, spawn2.transform.position.z); GameObject PlayerSpawned; if (PlayerPrefs.GetInt("GodmodeActivated") == 1) { //godmodeAttiva PlayerSpawned = Instantiate(playerGOD, position2, spawn2.transform.rotation); } else { //GodmodeDisattiva PlayerSpawned = Instantiate(player, position2, spawn2.transform.rotation); } hudOn = GameObject.Find("HUD").GetComponent <DetectedActDeact>(); hudOn.thing.SetActive(true); //set new totalscore PlayerSpawned.GetComponent <ScoreController>().SetTotalScore(PlayerPrefs.GetInt("PlayerTotalScore")); } if (PlayerPrefs.GetInt("Checkpoint") == 3) { Vector3 position2 = new Vector3(spawn3.transform.position.x, spawn3.transform.position.y, spawn3.transform.position.z); GameObject PlayerSpawned; if (PlayerPrefs.GetInt("GodmodeActivated") == 1) { //godmodeAttiva PlayerSpawned = Instantiate(playerGOD, position2, spawn3.transform.rotation); } else { //GodmodeDisattiva PlayerSpawned = Instantiate(player, position2, spawn3.transform.rotation); } hudOn = GameObject.Find("HUD").GetComponent <DetectedActDeact>(); hudOn.thing.SetActive(true); //set new totalscore PlayerSpawned.GetComponent <ScoreController>().SetTotalScore(PlayerPrefs.GetInt("PlayerTotalScore")); } }
public virtual void PopulateSlot(PlayerSpawned playerSpanwed) { playerSpanwed.player.GetComponent <InventoryModel>().AddSlot(gameObject.name); }
private void Spawn() { Player player = Instantiate(_player, transform.position, Quaternion.identity); PlayerSpawned?.Invoke(player); }
public void OnPlayerSpawned(IPlayerSpawnedEvent evt) => PlayerSpawned?.Invoke(evt);