protected virtual void OnUpdate()
 {
     if (m_PhyCtroller != null)
     {
         m_PhyCtroller.OnUpdate();
     }
     Attack();
     Move();
 }
示例#2
0
        private void Update()
        {
            if (IsDead)
            {
                return;
            }
            if (Input.GetKeyDown(KeyCode.A))
            {
                ToJump();
            }

            if (Input.GetKeyDown(KeyCode.B))
            {
                ToHurt(5);
            }
            if (Input.touchCount == 1)
            {
                if (!m_IsPress)
                {
                    ToJump();
                }
                m_IsPress = true;
            }
            if (Input.touchCount == 0)
            {
                m_IsPress = false;
            }

            m_PhyCtroller.OnUpdate();
            CheckSide();
            CheckAbove();
            CheckBelow();
            Rigidbody.velocity = new Vector2(HorizontalVelocity, Rigidbody.velocity.y);
            if (HorizontalVelocity < 0)
            {
                transform.eulerAngles = new Vector3(0, -180, 0);
            }
            else
            {
                transform.eulerAngles = new Vector3(0, 0, 0);
            }
            transform.position = new Vector3(transform.position.x, transform.position.y, -1.5f);
            if (CurRoleAI == null)
            {
                return;
            }
            CurRoleAI.DoAI();
        }