示例#1
0
    private void SpawnPlayerAt(Vector3 destPosition, Quaternion destRotation)
    {
        if (CurrentPlayer)
        {
            Destroy(CurrentPlayer);
        }

        CurrentPlayer = Instantiate(_playerPrefab, destPosition, destRotation);

        /*CurrentPlayer.GetComponent<NavMeshAgent>().Warp( destPosition );
         * CurrentPlayer.transform.rotation = destRotation;*/

        OnPlayerChanged?.Invoke(CurrentPlayer);
    }
        private void ChangePlayer()
        {
            OnPlayerChanged.Invoke();

            Dictionary <byte, object> data = new Dictionary <byte, object>();

            data.Add(0, CurrentActor.Nickname.Length == 0 ? "User_" + CurrentActor.ActorNr : CurrentActor.Nickname);
            data.Add(1, actors[current].ActorNr);

            Dictionary <byte, object> parameters = new Dictionary <byte, object>();

            parameters.Add(245, data);
            pluginHost.BroadcastEvent(ReciverGroup.All, 0, 0, (int)Event.CurrentPlayerChanged, parameters, CacheOperations.DoNotCache);

            log.DebugFormat("Player changed. Current is Player {0}.", CurrentActor.ActorNr);
        }
 public override void OnStopClient()
 {
     networkManager.RoomPlayers.Remove(this);
     OnPlayerChanged?.Invoke();
 }
 public void UpdateUi(bool oldValue, bool newValue) => OnPlayerChanged?.Invoke();
 public void UpdateUi(string oldName, string newName) => OnPlayerChanged?.Invoke();
    public override void OnStartClient()
    {
        networkManager.RoomPlayers.Add(this);

        OnPlayerChanged?.Invoke();
    }
示例#7
0
 public void RemovePlayer()
 {
     Player?.RemoveDevice(this);
     Player = null;
     OnPlayerChanged?.Invoke(this);
 }
示例#8
0
 public void AddPlayer(Player player, DeviceCode deviceCode)
 {
     Player = player;
     Player.AddDevice(this, deviceCode);
     OnPlayerChanged?.Invoke(this);
 }