Ejemplo n.º 1
0
 public override void DidMoveToView(SpriteKit.SKView view)
 {
     base.DidMoveToView (view);
     Player = new AgentNode (this, DefaultAgentRadius, new CGPoint (Frame.GetMidX (), Frame.GetMidY ()));
     Player.Agent.Behavior = new GKBehavior ();
     AgentSystem.AddComponent (Player.Agent);
     SeekGoal = GKGoal.GetGoalToSeekAgent (TrackingAgent);
 }
Ejemplo n.º 2
0
 public override void DidMoveToView(SpriteKit.SKView view)
 {
     base.DidMoveToView (view);
     var wanderer = new AgentNode (this, DefaultAgentRadius, new CGPoint (Frame.GetMidX (), Frame.GetMidY ())) {
         Color = SKColor.Cyan
     };
     wanderer.Agent.Behavior = GKBehavior.FromGoal (GKGoal.GetGoalToWander(10), 100f);
     AgentSystem.AddComponent (wanderer.Agent);
 }
Ejemplo n.º 3
0
        public override void DidMoveToView(SpriteKit.SKView view)
        {
            base.DidMoveToView (view);
            Player = new AgentNode (this, DefaultAgentRadius, new CGPoint (Frame.GetMidX (), Frame.GetMidY ()));
            Player.Agent.Behavior = new GKBehavior ();
            AgentSystem.AddComponent (Player.Agent);
            Player.Agent.MaxSpeed *= 1.2f;

            SeekGoal = GKGoal.GetGoalToSeekAgent (TrackingAgent);

            Friends = new [] {
                AddFriend (new CGPoint (Frame.GetMidX () - 150f, Frame.GetMidY ())),
                AddFriend (new CGPoint (Frame.GetMidX () + 150f, Frame.GetMidY ()))
            };
            SeparateGoal = GKGoal.GetGoalToSeparate (new [] { Player.Agent }, 100f, (float)(Math.PI * 2));
            var behavior = GKBehavior.FromGoal (SeparateGoal, 100f);

            foreach (var friend in Friends)
                friend.Agent.Behavior = behavior;
        }