예제 #1
0
    void FixedUpdate()
    {
        RaycastHit hit;

        if (Physics.Raycast(transform.position, fwd, out hit, 1.0f, mask))
        {
            print(hit.collider.tag);
            if (hit.collider.tag == "Player")
            {
                print("PLAYER TOOK DAMAGE!");
            }
            if (hit.collider.tag == "Obstacle")
            {
                transform.eulerAngles = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y * -1, transform.eulerAngles.z);
                fwd     = transform.TransformDirection(Vector3.forward);
                isRight = !isRight;
            }
        }

        if (isRight)
        {
            hm.HorizontalMovementAction("Right");
        }
        else
        {
            hm.HorizontalMovementAction("Left");
        }
    }
예제 #2
0
 public void HorizontalMove(string side)
 {
     if (!dash.IsDashing)
     {
         lastSide = side;
         hm.HorizontalMovementAction(side);
     }
 }