Пример #1
0
    /// <summary>
    /// Display an image that follow the hidden player
    /// Convert the player position into a screen position for the image
    /// </summary>
    /// <param name="_followedPlayer">Hidden and followed player </param>
    /// <param name="_followingImage">The image that follows the player</param>
    /// <returns></returns>
    private IEnumerator FollowHiddenPlayer(TDS_Player _followedPlayer, Image _followingImage)
    {
        if (!_followedPlayer || !Application.isPlaying || Camera.main == null)
        {
            yield break;
        }
        _followingImage.gameObject.SetActive(true);
        Vector2 _screenPos = Camera.main.WorldToScreenPoint(_followedPlayer.transform.position);

        _screenPos.x = Mathf.Clamp(_screenPos.x, _followingImage.rectTransform.rect.width / 2, Screen.width - (_followingImage.rectTransform.rect.width / 2));
        _screenPos.y = Mathf.Clamp(_screenPos.y, _followingImage.rectTransform.rect.height / 2, Screen.width - (_followingImage.rectTransform.rect.height / 2));
        _followingImage.transform.position             = _screenPos;
        _followingImage.transform.GetChild(0).rotation = Quaternion.Euler(0, 0, _screenPos.x < Screen.width / 2 ? 90 : -90);
        while (_followedPlayer && _followingImage && Application.isPlaying)
        {
            //Debug.LogError(Camera.main.WorldToScreenPoint(_followedPlayer.transform.position));
            _screenPos   = Camera.main.WorldToScreenPoint(_followedPlayer.transform.position);
            _screenPos.x = Mathf.Clamp(_screenPos.x, _followingImage.rectTransform.rect.width / 2, Screen.width - (_followingImage.rectTransform.rect.width / 2));
            _screenPos.y = Mathf.Clamp(_screenPos.y, _followingImage.rectTransform.rect.height / 2, Screen.height - (_followingImage.rectTransform.rect.height / 2));
            _followingImage.transform.position = Vector3.MoveTowards(_followingImage.transform.position, _screenPos, Time.deltaTime * 3600);

            yield return(null);
        }
        if (!_followedPlayer)
        {
            _followingImage.gameObject.SetActive(false);
        }
        yield return(null);
    }
Пример #2
0
    // OnTriggerEnter is called when the GameObject collides with another GameObject
    private void OnTriggerEnter(Collider other)
    {
        // On trigger enter, heal the player and activate the checkpoint
        if (other.gameObject.HasTag("Player") && !healedPlayers.Contains(other.GetInstanceID()))
        {
            healedPlayers.Add(other.GetInstanceID());

            TDS_Player _player = other.GetComponent <TDS_Player>();
            _player.Heal(999);

            // Call the OnPassCheckpoint event on the player machine
            TDS_RPCManager.Instance?.RPCPhotonView.RPC("CallMethodOnline", _player.photonView.owner, TDS_RPCManager.GetInfo(photonView, GetType(), "CallOnPassCheckpoint"), new object[] { });

            if (!isActivated)
            {
                Activate();
            }

            // If the checkpoint healed all players, just disable its box trigger
            if (healedPlayers.Count == TDS_LevelManager.Instance.AllPlayers.Length)
            {
                trigger.enabled = false;
            }
        }
    }
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (!player)
     {
         player = animator.GetComponent <TDS_Player>();
     }
     player.CanFlip = false;
 }
Пример #4
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    //{
    //
    //}

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    //{
    //
    //}

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (!player)
        {
            player = animator.GetComponent <TDS_Player>();
        }
        player.StopJumpAttackMovement();
    }
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    //{
    //
    //}

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    //{
    //
    //}

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (!player)
        {
            player = animator.GetComponent <TDS_Player>();
        }
        player.UnfreezePlayer();
    }
Пример #6
0
    /// <summary>
    /// Activate or desactivate an image on the left or the right of the screen to show where is a player when he's not rendered
    /// </summary>
    /// <param name="_player">Visible or invisible player</param>
    /// <param name="_isInvisible">is the player invisible?</param>
    public void DisplayHiddenPlayerPosition(TDS_Player _player, bool _isInvisible)
    {
        if (!_player)
        {
            return;
        }
        Image _image = null;

        switch (_player.PlayerType)
        {
        case PlayerType.Unknown:
            break;

        case PlayerType.BeardLady:
            _image = hiddenBeardLadyImage;
            break;

        case PlayerType.FatLady:
            _image = hiddenFatLadyImage;
            break;

        case PlayerType.FireEater:
            _image = hiddenFireEaterImage;
            break;

        case PlayerType.Juggler:
            _image = hiddenJugglerImage;
            break;

        default:
            break;
        }
        if (!_image)
        {
            return;
        }
        if (_isInvisible)
        {
            if (!followHiddenPlayerCouroutines.ContainsKey(_player.PlayerType))
            {
                Coroutine _c = StartCoroutine(FollowHiddenPlayer(_player, _image));
                followHiddenPlayerCouroutines.Add(_player.PlayerType, _c);
            }
        }
        else
        {
            if (followHiddenPlayerCouroutines.ContainsKey(_player.PlayerType))
            {
                Coroutine _c = followHiddenPlayerCouroutines[_player.PlayerType];
                if (_c != null)
                {
                    StopCoroutine(_c);
                }
                followHiddenPlayerCouroutines.Remove(_player.PlayerType);
            }
            _image.gameObject.SetActive(false);
        }
    }
Пример #7
0
    /// <summary>
    /// Called from a non-master client
    /// Call the method use in the master
    /// </summary>
    /// <param name="_playerId"></param>
    private void UseOnline(int _playerId)
    {
        if (!PhotonNetwork.isMasterClient)
        {
            return;
        }
        TDS_Player _player = PhotonView.Find(_playerId).GetComponent <TDS_Player>();

        Use(_player);
    }
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (!player)
     {
         player = animator.GetComponent <TDS_Player>();
     }
     if (player.photonView.isMine)
     {
         player.ResetCombo();
     }
 }
Пример #9
0
 /// <summary>
 /// Remove the player with the selected id from the onlinePlayers list
 /// </summary>
 /// <param name="_playerId">Id of the removed player</param>
 public void RemoveOnlinePlayer(TDS_Player _player)
 {
     if (!_player)
     {
         Debug.LogError("Player Not Found");
         return;
     }
     TDS_UIManager.Instance.ClearUIRelatives(_player.PlayerType);
     if (otherPlayers.Contains(_player))
     {
         otherPlayers.Remove(_player);
     }
 }
Пример #10
0
    /// <summary>
    /// Instantiate player LifeBar and set its owner as the local player
    /// if local
    /// </summary>
    /// <param name="_player"></param>
    public void SetPlayerLifeBar(TDS_Player _player)
    {
        TDS_PlayerLifeBar _playerLifeBar = null;

        switch (_player.PlayerType)
        {
        case PlayerType.Unknown:
            break;

        case PlayerType.BeardLady:
            _playerLifeBar = beardLadyLifeBar;
            break;

        case PlayerType.FatLady:
            _playerLifeBar = fatLadyLifeBar;
            break;

        case PlayerType.FireEater:
            _playerLifeBar = fireEaterLifeBar;
            break;

        case PlayerType.Juggler:
            _playerLifeBar = jugglerLifeBar;
            break;

        default:
            break;
        }
        if (!_playerLifeBar)
        {
            return;
        }
        _playerLifeBar.SetOwner(_player);
        _playerLifeBar.UpdateLifeBar(_player.HealthCurrent);
        _playerLifeBar.gameObject.SetActive(true);
        _player.HealthBar           = _playerLifeBar;
        _player.OnHealthChanged    += _playerLifeBar.UpdateLifeBar;
        _player.OnTriggerHowToPlay += _playerLifeBar.TriggerHowToPlayInfo;
        if (_player is TDS_Juggler _juggler)
        {
            _juggler.OnHasObject += _playerLifeBar.DisplayThrowObjectInfo;
        }
        else
        {
            _player.OnHasObject += _playerLifeBar.DisplayThrowObjectInfo;
        }
        if (_player == TDS_LevelManager.Instance.LocalPlayer && _player.photonView.isMine)
        {
            _playerLifeBar.transform.SetSiblingIndex(0);
        }
    }
Пример #11
0
    /// <summary>
    /// Called when a player catch the rabbit
    /// Heal the player and Destroy the rabbit
    /// </summary>
    /// <param name="_player"></param>
    public override void Use(TDS_Player _player)
    {
        if (!PhotonNetwork.isMasterClient)
        {
            TDS_RPCManager.Instance.RPCPhotonView.RPC("CallMethodOnline", PhotonTargets.MasterClient, TDS_RPCManager.GetInfo(photonView, GetType(), "UseOnline"), new object[] { _player.PhotonID });
            return;
        }
        int _healingValue = UnityEngine.Random.Range(healingValueMin, healingValueMax);

        _player.Heal(_healingValue);

        OnUseRabbit?.Invoke();
        TDS_VFXManager.Instance.SpawnEffect(FXType.RabbitPoof, transform.position + Vector3.up);
        PhotonNetwork.Destroy(gameObject);
    }
Пример #12
0
    /// <summary>
    /// Removes a player from the stored ones in collider.
    /// </summary>
    /// <param name="_player">Player to remove.</param>
    private void RemovePlayer(TDS_Player _player)
    {
        if (_player == null)
        {
            return;
        }

        _player.OnPlayerDie -= RemovePlayer;
        playersIn.Remove(_player);

        if (playersIn.Count > 0)
        {
            return;
        }

        StartExitEvents();
    }
Пример #13
0
    /// <summary>
    /// Make the player with the type contained in the GameManager spawn
    /// </summary>
    public void Spawn()
    {
        if (PhotonNetwork.offlineMode)
        {
            for (int i = 0; i < TDS_GameManager.PlayersInfo.Count; i++)
            {
                TDS_PlayerInfo _info = TDS_GameManager.PlayersInfo[i];
                if ((_info != null) && (_info.PlayerType != PlayerType.Unknown))
                {
                    otherPlayers.Add((Instantiate(Resources.Load(_info.PlayerType.ToString()), StartSpawnPoints[0], Quaternion.identity) as GameObject).GetComponent <TDS_Player>());
                }
            }

            TDS_Camera.Instance.SetLocalMultiplayerCamera();
        }
        else if (TDS_GameManager.LocalPlayer != PlayerType.Unknown)
        {
            localPlayer = PhotonNetwork.Instantiate(TDS_GameManager.LocalPlayer.ToString(), StartSpawnPoints[0], Quaternion.identity, 0).GetComponent <TDS_Player>();
            TDS_Camera.Instance.Target = localPlayer.transform;
        }
    }
Пример #14
0
    /// <summary>
    /// Set the new resolution of the game.
    /// </summary>
    /// <param name="_newResolution">New game resolution.</param>
    public static void SetResolution(Resolution _newResolution)
    {
        CurrentResolution = _newResolution;

        // Calculates camera rect for aspect ratio of 16/9
        float _targetAspect = TDS_Camera.CAMERA_ASPECT_WIDTH / TDS_Camera.CAMERA_ASPECT_HEIGHT;
        float _cameraAspect = (float)Screen.width / Screen.height;

        float _heightRatio = _cameraAspect / _targetAspect;

        // If ratio is correct, the keep it
        if (_heightRatio == 1)
        {
            CameraRect = new Rect(0, 0, 1, 1);
        }
        // If ratio is inferior to one (not large enough), set black bars on top & bottom of the screen
        else if (_heightRatio < 1)
        {
            CameraRect = new Rect(0, (1 - _heightRatio) / 2, 1, _heightRatio);
        }
        // If superior to one (too large), then set black bars on left & right of the screen
        else
        {
            float _widthRatio = 1 / _heightRatio;
            CameraRect = new Rect((1 - _widthRatio) / 2, 0, _widthRatio, 1);
        }

        // Set camera aspect if needed
        TDS_Camera.Instance?.SetCameraAspect();

        // Set aim bounds for local player if Juggler
        TDS_Player _juggler = TDS_LevelManager.Instance?.AllPlayers.Where(p => p.PlayerType == PlayerType.Juggler).FirstOrDefault();

        if (_juggler && _juggler.photonView.isMine)
        {
            ((TDS_Juggler)_juggler).SetAimBounds();
        }
    }
Пример #15
0
    /// <summary>
    /// Make all dead players respawn to this point.
    /// </summary>
    /// <returns></returns>
    private IEnumerator RespawnCoroutine()
    {
        TDS_Player[] _deadPlayers = TDS_LevelManager.Instance.AllPlayers.Where(p => p.IsDead).ToArray();

        if (_deadPlayers.Length == 0)
        {
            yield break;
        }

        yield return(new WaitForSeconds(1));

        TDS_Player _player = null;

        for (int _i = 0; _i < _deadPlayers.Length; _i++)
        {
            _player = _deadPlayers[_i];

            // Make player disappear in smoke
            TDS_VFXManager.Instance.SpawnEffect(FXType.MagicAppear, new Vector3(_player.transform.position.x, _player.transform.position.y + .25f, _player.transform.position.z));

            Vector3 _newPos = transform.position + spawnPosition;
            _player.DisappearBeforeRespawn(_newPos.x, _newPos.y, _newPos.z);

            yield return(new WaitForSeconds(.5f));

            // Trigger curtain animation
            SetAnimState(CheckpointAnimState.Resurrect);

            if (!_player.IsFacingRight)
            {
                _player.Flip();
            }

            _player.RespawnPlayer();

            yield return(new WaitForSeconds(.5f));
        }
    }
Пример #16
0
    // OnTriggerExit is called when the Collider other has stopped touching the trigger
    protected override void OnTriggerExit(Collider other)
    {
        if (!other.gameObject.HasTag(detectedTags.ObjectTags))
        {
            return;
        }

        TDS_Player _player = other.GetComponent <TDS_Player>();

        if (!_player)
        {
            return;
        }

        playersIn.Remove(_player);
        _player.OnPlayerDie -= RemovePlayer;

        if (playersIn.Count > 0)
        {
            return;
        }

        StartExitEvents();
    }
Пример #17
0
    public override void SetOwner(TDS_Character _owner)
    {
        base.SetOwner(_owner);

        TDS_Player _player = (TDS_Player)_owner;

        if (comboCounter)
        {
            if (_player)
            {
                if ((!PhotonNetwork.offlineMode && TDS_GameManager.LocalPlayer == playerType) || PhotonNetwork.offlineMode)
                {
                    ((TDS_Player)_owner).HitBox.OnTouch += comboCounter.IncreaseCombo;
                    comboCounter.ResetComboManager();
                    comboCounter.gameObject.SetActive(true);
                    TDS_UIManager.Instance.ComboManager = comboCounter;
                }
            }
            else
            {
                comboCounter.gameObject.SetActive(false);
            }
        }

        if (!_player.photonView.isMine)
        {
            return;
        }

        // Set inputs informations
        if (_player)
        {
            bool _isController = true;

            if ((_player.Controller == TDS_GameManager.InputsAsset.Controllers[1]) || ((_player.Controller == TDS_GameManager.InputsAsset.Controllers[0]) && Input.GetJoystickNames().Length == 0))
            {
                _isController = false;
            }

            // Set throw infos
            string[] _info = null;

            if (_player.PlayerType != PlayerType.Juggler)
            {
                _info = new string[1];

                if (_isController)
                {
                    _info[0] = "Controller_B";
                }
                else
                {
                    _info[0] = "Keyboard_F";
                }

                throwObjectText.text = string.Format(throwObjectText.text, $"<sprite name={_info[0]}>");
            }
            else
            {
                _info = new string[2];

                if (_isController)
                {
                    _info[0] = "Controller_LT";
                    _info[1] = "Controller_RT";
                }
                else
                {
                    _info[0] = "Keyboard_Ctrl";
                    _info[1] = "Keyboard_Shift";
                }

                throwObjectText.text = string.Format(throwObjectText.text, $"<sprite name={_info[0]}>", $"<sprite name={_info[1]}>");
            }

            // Set interact button
            _player.InteractionBox.InteractText.text = $"<sprite name={(_isController ? "Controller_B" : "Keyboard_F")}>";

            // Set button to show / hide how to play
            showHowToPlayText.text = string.Format(showHowToPlayText.text, $"<sprite name={(_isController ? "Controller_Select" : "Keyboard_Tab")}>");

            // Set how to play infos
            switch (_player.PlayerType)
            {
            case PlayerType.BeardLady:
                // Nothing to change here
                break;

            case PlayerType.FatLady:
                _info = new string[2];

                if (_isController)
                {
                    _info[0] = "Controller_Y";
                    _info[1] = "Controller_LB";
                }
                else
                {
                    _info[0] = "Keyboard_A";
                    _info[1] = "Keyboard_R";
                }

                howToPlayText.text = string.Format(howToPlayText.text, $"<sprite name={_info[0]}>", $"<sprite name={_info[1]}>");
                break;

            case PlayerType.FireEater:
                _info = new string[2];

                if (_isController)
                {
                    _info[0] = "Controller_X";
                    _info[1] = "Controller_Y";
                }
                else
                {
                    _info[0] = "Keyboard_E";
                    _info[1] = "Keyboard_A";
                }

                howToPlayText.text = string.Format(howToPlayText.text, $"<sprite name={_info[0]}>", $"<sprite name={_info[1]}>");
                break;

            case PlayerType.Juggler:
                _info = new string[5];

                if (_isController)
                {
                    _info[0] = "Controller_B";
                    _info[1] = "Controller_LT";
                    _info[2] = "Controller_Joystick";
                    _info[3] = "Controller_RT";
                    _info[4] = "Controller_DPadX";
                }
                else
                {
                    _info = new string[7];

                    _info[0] = "Keyboard_F";
                    _info[1] = "Keyboard_Ctrl";
                    _info[2] = "Keyboard_J> & <sprite name=Keyboard_L";
                    _info[3] = "Keyboard_Shift";
                    _info[4] = "Keyboard_1> & <sprite name=Keyboard_2";
                }

                howToPlayText.text = string.Format(howToPlayText.text, $"<sprite name={_info[0]}>", $"<sprite name={_info[1]}>", $"<sprite name={_info[2]}>", $"<sprite name={_info[3]}>", $"<sprite name={_info[4]}>");
                break;

            default:
                break;
            }
        }

        if (howToPlayAnchor)
        {
            howToPlayAnchor.SetActive(true);
        }
        if (howToPlayInfo && !howToPlayInfo.activeInHierarchy && (TDS_GameManager.CurrentSceneIndex == 1))
        {
            howToPlayInfo.SetActive(true);
        }
    }
Пример #18
0
 abstract public void Use(TDS_Player _player);
Пример #19
0
 /// <summary>
 /// Get the enemies within a range around a player
 /// </summary>
 /// <param name="_player">Player targeted</param>
 /// <param name="_distance">Range around the player</param>
 /// <returns></returns>
 public int GetEnemyContactCount(TDS_Player _player, float _distance, TDS_Enemy _askingEnemy)
 {
     return(spawnedEnemies.Where(e => Vector3.Distance(_player.transform.position, e.transform.position) < _distance && e != _askingEnemy).Count());
 }
Пример #20
0
 /// <summary>
 /// Adds a player to follow.
 /// </summary>
 /// <param name="_player">Player to follow.</param>
 public void AddLocalPlayer(TDS_Player _player)
 {
     players.Add(_player);
 }
Пример #21
0
    /// <summary>
    /// Makes this camera follow the players.
    /// </summary>
    private void FollowPlayers()
    {
        // If no target, return
        if ((players.Count == 0) || (lookTargetCoroutine != null))
        {
            return;
        }

        TDS_Player[] _playersByX      = players.OrderBy(p => p.transform.position.x).ToArray();
        TDS_Player   _mostRightPlayer = _playersByX.Last();

        float _mostLeftPlayerFromView = _playersByX[0].transform.position.x - (transform.position.x - CameraXRatio);
        bool  _isPlayerOutOfScreen    = _mostLeftPlayerFromView < 1;

        // Get movement
        float _xIdealPos = _mostRightPlayer.transform.position.x + Offset.x - (_isPlayerOutOfScreen ? CameraXRatio - 2 : _mostLeftPlayerFromView < CameraXRatio ? CameraXRatio - _mostLeftPlayerFromView : 0);
        float _yIdealPos = transform.position.y + (-(.5f - camera.WorldToViewportPoint(players.OrderBy(p => p.transform.position.z).First().transform.position).y) * camera.orthographicSize * 2 * VIEWPORT_CALCL_Y_COEF) + Offset.y;

        // If reaching destination, stop moving
        if ((transform.position - new Vector3(_xIdealPos, _yIdealPos, Offset.z)).magnitude < .01f)
        {
            if (isMoving)
            {
                speedCurrent = 0;
                isMoving     = false;
            }

            return;
        }
        else
        {
            // When starting moving, initializes initial speed
            if (!isMoving)
            {
                speedCurrent = speedInitial;
                isMoving     = true;
            }
            // If not, increase speed if needed
            else if (speedCurrent < speedMax)
            {
                SpeedCurrent += Time.deltaTime * ((speedMax - speedInitial) / speedAccelerationTime);
            }

            Vector3 _destination = new Vector3()
            {
                x = Mathf.Lerp(transform.position.x, _xIdealPos, Time.deltaTime * speedCurrent * speedCoef),
                y = Mathf.Lerp(transform.position.y, _yIdealPos, Time.deltaTime * speedCurrent * speedCoef),
                z = Offset.z
            };

            Vector3 _movement = _destination - transform.position;

            // Clamp position
            float _newBound;

            // X movement
            if (_movement.x != 0)
            {
                if (_movement.x < 0)
                {
                    _newBound = _destination.x - CameraXRatio;

                    if (_newBound < currentBounds.XMin)
                    {
                        _destination.x += CameraXRatio * 2 * camera.WorldToViewportPoint(currentBounds.XMinVector).x;

                        // Cancel movement if needed
                        if ((_destination.x - transform.position.x) < .0001f)
                        {
                            _destination.x = transform.position.x;
                        }
                    }
                }
                else
                {
                    _newBound = _destination.x + CameraXRatio;

                    if (_newBound > currentBounds.XMax)
                    {
                        _destination.x -= CameraXRatio * 2 * (1 - camera.WorldToViewportPoint(currentBounds.XMaxVector).x);

                        // Cancel movement if needed
                        if ((transform.position.x - _destination.x) < .0001f)
                        {
                            _destination.x = transform.position.x;
                        }
                    }
                }
            }
            // Y movement
            if (_movement.y != 0)
            {
                if (_movement.y < 0)
                {
                    _newBound = camera.WorldToViewportPoint(currentBounds.ZMinVector - _movement).y;

                    if (_newBound > 0)
                    {
                        _destination.y += camera.orthographicSize * 2 * VIEWPORT_CALCL_Y_COEF * camera.WorldToViewportPoint(currentBounds.ZMinVector).y;

                        // Cancel movement if needed
                        if ((_destination.y - transform.position.y) < .0001f)
                        {
                            _destination.y = transform.position.y;
                        }
                    }
                }
                else
                {
                    _newBound = camera.WorldToViewportPoint(currentBounds.ZMaxVector - _movement).y;

                    if (_newBound < ViewportYMacBoundValue)
                    {
                        _destination.y -= camera.orthographicSize * 2 * VIEWPORT_CALCL_Y_COEF * (ViewportYMacBoundValue - camera.WorldToViewportPoint(currentBounds.ZMaxVector).y);

                        // Cancel movement if needed
                        if ((transform.position.y - _destination.y) < .0001f)
                        {
                            _destination.y = transform.position.y;
                        }
                    }
                }
            }

            // Moves the camera if needed, or stop moving
            if (transform.position == _destination)
            {
                if (isMoving)
                {
                    isMoving     = false;
                    SpeedCurrent = 0;
                }
            }
            else
            {
                transform.position = _destination;
            }
        }
    }
Пример #22
0
 /// <summary>
 /// Removes a player from following.
 /// </summary>
 /// <param name="_player">Player to remove.</param>
 public void RemoveLocalPlayer(TDS_Player _player)
 {
     players.Remove(_player);
 }
Пример #23
0
 /// <summary>
 /// Add the player in the list of online players
 /// </summary>
 /// <param name="_onlinePlayer">Player to add to the onlinePlayer List</param>
 public void InitOnlinePlayer(TDS_Player _onlinePlayer)
 {
     otherPlayers.Add(_onlinePlayer);
 }