Example #1
0
    void Rotation()
    {
        float inputX = 0;
        float inputY = 0;

        if (Application.platform == RuntimePlatform.WindowsEditor)
        {
            //InputByWindow(ref _Rot);
            inputX = Input.GetAxis("Mouse X");
            inputY = Input.GetAxis("Mouse Y");
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
            //InputByAndroid(ref _Rot);
            Vector2 vector = _BallContorl.GetVectorOffset();
            inputX = vector.x;
            inputY = vector.y;
        }

        if (_Reverse_Y)
        {
            inputX = -inputX;
        }
        if (_Reverse_X)
        {
            inputY = -inputY;
        }

        _Rot.y += inputX * Time.deltaTime * _Speed;
        _Rot.x += inputY * Time.deltaTime * _Speed;

        //InputByAndroid(ref _Rot);

        _DebugLabel.AddItem("Camera_Rot", _Rot);

        _Rot.y = Clamp360(_Rot.y);
        _Rot.x = Clamp360(_Rot.x);

        _Rot.x = Mathf.Clamp(_Rot.x, _EulerBround.buttom, _EulerBround.top);

        transform.rotation = Quaternion.Euler(_Rot);

        _PlayerPos = _PlayerGo.transform.position + _LookAtOffset;

        transform.position = _PlayerPos + transform.rotation * new Vector3(0, 0, -_Distance);
    }
Example #2
0
    public void OnPointerUp(PointerEventData eventData)
    {
        Ball.transform.position = transform.position;
        VectorOffset            = Vector2.zero;

        if (Input.touchCount == 1)
        {
            _PlayerControl.ClearBallContorlTouchId();
        }


        //_DebugLabel.AddItem("BallContorl-Offset", VectorOffset);

        _DebugLabel.AddItem(gameObject.name, _TouchId);
    }
Example #3
0
    public PlayerState GetPlayerState()
    {
        string name;

        if (_Animator.IsInTransition(0))
        {
            name = _Animator.GetNextAnimatorClipInfo(0)[0].clip.name;
        }
        else
        {
            name = _Animator.GetCurrentAnimatorClipInfo(0)[0].clip.name;
        }

        switch (name)
        {
        case "Idle":
        case "Attackstandy":
            PlayerState = PlayerState.Idel;
            break;

        case "Walk":
            PlayerState = PlayerState.Walk;
            break;

        case "Run00":
            PlayerState = PlayerState.Run;
            break;

        case "Jump":
        case "Jump_Dogger":
            PlayerState = PlayerState.Jump;
            break;

        case "Attack02":
        case "Attack01":
            PlayerState = PlayerState.Attack;
            break;

        default:
            PlayerState = PlayerState.None;
            break;
        }

        _Debug.AddItem("PlayerState", Enum.GetName(typeof(PlayerState), PlayerState));
        return(PlayerState);
    }
    void Update()
    {
        //BUG 没有水

        int i = 0;

        foreach (var go in _AllGo)
        {
            if (Vector3.Distance(go.transform.position, _Player.transform.position) >= _Distant)
            {
                go.SetActive(false);
            }
            else
            {
                go.SetActive(true);
                i++;
            }
        }

        _Debug.AddItem("ShowUnitCount", i);
    }