Пример #1
0
    public override void SteerOther(BasicSteering controller)
    {
        GoblinSteering steering = controller as GoblinSteering;
        if (steering.SurfaceContact.normal == Vector2.zero)
        {
            controller.SetStrategy(JumpingGoblinFloatStrategy.Instance());
        }

        GoblinCombatStrategy.CheckTargets(steering,2);
        if (steering.Targets.Count != 0)
        {
            GameObject mainTarget = steering.Targets[0];
            if (mainTarget.tag == "Enemy")
            {
                if (mainTarget.GetComponent<PhysicsObject>().GetExtents().min.x - steering.GetComponent<PhysicsObject>().GetExtents().max.x < 0.1)
                {
                    steering.Stopped = true;
                }
            }
            else if (TargetJumpTags.Contains(mainTarget.tag) && mainTarget.GetComponent<PhysicsObject>().GetExtents().min.x - steering.GetComponent<PhysicsObject>().GetExtents().max.x > 1.5)
            {
                float height = mainTarget.GetComponent<PhysicsObject>().FindMaxHeight() - steering.GetComponent<PhysicsObject>().GetExtents().min.y;
                controller.GetComponent<JumpingGoblinLocomotion>().Jump(new Vector2(height / 4, height));
            }
            else
            {
                controller.SetStrategy(JumpingGoblinCombatStrategy.Instance());
            }
        }
    }
Пример #2
0
 public virtual void SteerOther(BasicSteering controller)
 {
     GoblinSteering steering = controller as GoblinSteering;
     if (steering.SurfaceContact.normal != Vector2.zero)
     {
         controller.SetStrategy(GoblinMoveStrategy.Instance());
     }
 }
 public override void SteerOther(BasicSteering controller)
 {
     JumpingGoblinSteering steering = controller as JumpingGoblinSteering;
     if (steering.SurfaceContact.normal != Vector2.zero)
     {
         controller.SetStrategy(JumpingGoblinMoveStrategy.Instance());
     }
 }
Пример #4
0
    public virtual void SteerOther(BasicSteering controller)
    {
        GoblinSteering steering = controller as GoblinSteering;
        if(steering.SurfaceContact.normal == Vector2.zero)
        {
            controller.SetStrategy(GoblinFloatStrategy.Instance());
        }

        GoblinCombatStrategy.CheckTargets(steering);
        if(steering.Targets.Count!=0)
        {
            if (steering.Targets[0].tag != "Enemy")
            {
                controller.SetStrategy(GoblinCombatStrategy.Instance());
            }
            else if (steering.Targets[0].GetComponent<PhysicsObject>().GetExtents().min.x-steering.GetComponent<GoblinPhysics>().GetExtents().max.x<0.1)
            {
                steering.Stopped = false;
            }
        }
    }