コード例 #1
0
    void UpdateCollisionPlayer()
    {
        m_timerCollisionPlayer = Mathf.Max(m_timerCollisionPlayer - Time.deltaTime, 0f);

        if (Vector3.Distance(m_player1.transform.position, m_player2.transform.position) < Constants.DistCollision)
        {
            if (m_timerCollisionPlayer == 0f)
            {
                m_timerCollisionPlayer = m_timerCollisionPlayerMax;
                if (m_p1Script.IsCat())
                {
                    m_p2Script.SetStun();
                    m_camerasScript.SetWinEvent(m_p1Script.m_side, 30);
                }
                if (m_p2Script.IsCat())
                {
                    m_p1Script.SetStun();
                    m_camerasScript.SetWinEvent(m_p2Script.m_side, 30);
                }
                m_source.PlayOneShot(m_winSound, 1f);
                m_p1Script.InvertJob();
                m_p2Script.InvertJob();
            }
        }
    }
コード例 #2
0
    void UpdateStateMobile()
    {
        if (m_keyLeft != KeyCode.LeftArrow)
        {
            return;
        }

        if (Input.touchCount > 0)
        {
            Touch touch = Input.GetTouch(0);

            if (touch.phase == TouchPhase.Began)
            {
                PlayerSide side     = PlayerSide.None;
                Vector2    position = touch.position;

                if (position.x < (Screen.width / 2) && position.y > (Screen.height / 2))
                {
                    side = PlayerSide.Front;
                }
                if (position.x > (Screen.width / 2) && position.y > (Screen.height / 2))
                {
                    side = PlayerSide.Right;
                }
                if (position.x < (Screen.width / 2) && position.y < (Screen.height / 2))
                {
                    side = PlayerSide.Back;
                }
                if (position.x > (Screen.width / 2) && position.y < (Screen.height / 2))
                {
                    side = PlayerSide.Left;
                }

                if (m_state == State.Idle)
                {
                    MoveMobile(side);
                }

                m_camerasScript.SetWinEvent(side, 10);
                m_isAIActive = false;
            }
        }
        UpdateStateMobileSimulate();
    }