コード例 #1
0
 public void EnablePlayerControl()
 {
     if (_player)
     {
         //_respawns.SetActive(true);
         //AbilityManager.Instance.enabled = true;
         AbilityManager.Instance.EndCutscene();
         _player.CanControl();
     }
 }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        if (_abilities.Count == 0 || _curAbility == null)
        {
            return;
        }

        if (_inCutscene)
        {
            return;
        }

        if (!_isWaiting && _player.IsTouchingGround() && !_player.HaveControl())
        {
            //if (!_inCutscene)
            //{
            _player.CanControl();
            //}
        }

        if (!_objInteraction.IsMovingObject())
        {
            if (Input.GetButtonDown("Switch"))
            {
                //int index = _abilities.IndexOf(_curAbility);
                //int newIndex = (index + 1) % _abilities.Count;
                //_curAbility = _abilities[newIndex];
            }
            else if (!_isWaiting && _player.IsTouchingGround() && Input.GetButtonDown("Invoke"))
            {
                if (!_curAbility.InUse() && _curAbility.CanUse())
                {
                    MetricManagerScript.instance.LogString("Gravity switched at position", _player.transform.position.ToString());
                    //_isWaiting = true;
                    _curAbility.UseAbility();
                    GameEvents.Instance.LayerUp();
                    //StartCoroutine(InvokeAbility());
                }
                else if (_curAbility.InUse() && _curAbility.CanUse())
                {
                    MetricManagerScript.instance.LogString("Gravity switched at position", _player.transform.position.ToString());
                    _curAbility.EndAbility();
                    GameEvents.Instance.LayerDown();
                }
            }
        }
    }