示例#1
0
 public void Walk(float diretion)
 {
     if (diretion > 0)
     {
         FacadeEnemy.Walk(classEnemy, Vector2.right);
     }
     else if (diretion < 0)
     {
         FacadeEnemy.Walk(classEnemy, Vector2.left);
     }
     else
     {
         FacadeEnemy.Idle(classEnemy);
     }
 }
示例#2
0
    void Update()
    {
        hitRight = Physics2D.Raycast(transform.position, Vector2.right, distanceView, 1 << LayerMask.NameToLayer("Hero"));
        hitLeft  = Physics2D.Raycast(transform.position, Vector2.left, distanceView, 1 << LayerMask.NameToLayer("Hero"));

        if (hitRight)
        {
            FacadeEnemy.Walk(this, Vector2.right);
        }
        else if (hitLeft)
        {
            FacadeEnemy.Walk(this, Vector2.left);
        }
        else
        {
            FacadeEnemy.Idle(this);
        }
    }