示例#1
0
        //**********************************************************************************************************************************************************************************
        //                      Методы инициализации и завершения
        //**********************************************************************************************************************************************************************************
        // Конструктор
        public Game(SKView GameView)
        {
            AppDomain.CurrentDomain.ProcessExit += ProcessExit;
            try
            {
                Graphics = new GameGraphics(this, GameView);
                /*
                clientInformation = new ClientInformation();

                clientInformation.OnGameStart = StartGameHandler;
                clientInformation.OnUpdateWaitingTable = UpdateWaitingPlayers;

                if (!clientInformation.TestVersion())
                {
                    Graphics.ShowMessage("У вас устаревшая версия приложения! Скачайте новую");
                    Environment.Exit(0);
                }
                */
                Graphics.ShowGuestScreen();
            }
            catch (Exception ex)
            {
                Graphics.ShowMessage (ex.Message);
                Environment.Exit(0);
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (SKView != null)
            {
                SKView.Dispose();
                SKView = null;
            }

            if (warriorButton != null)
            {
                warriorButton.Dispose();
                warriorButton = null;
            }

            if (archerButton != null)
            {
                archerButton.Dispose();
                archerButton = null;
            }

            if (loadingProgressIndicator != null)
            {
                loadingProgressIndicator.Dispose();
                loadingProgressIndicator = null;
            }

            if (gameLogo != null)
            {
                gameLogo.Dispose();
                gameLogo = null;
            }
        }
        public override void DidMoveToView(SKView view)
        {
            this.BackgroundColor = UIColor.Black;
            AddChild(new SKLabelNode("Chalkduster")
            {
                Text     = "NAWAGAMISAMA",
                FontSize = 40,
                Position = new CGPoint(Frame.Width / 2, Frame.Height - 50)
            });


            var w = View.Frame.Width / 3;

            _kumaSize   = new CGSize(w, w);
            _effectSize = new CGSize(w + 100, w + 100);

            _kumaList = new ArrayList();
            for (var y = 0; y < 3; y++)
            {
                for (var x = 0; x < 3; x++)
                {
                    _kumaList.Add(new Kuma(this, new CGPoint(x * w, y * w + 150), _kumaSize));
                }
            }

            _scoreLabel = new SKLabelNode("Chalkduster")
            {
                FontSize = 50,
                Position = new CGPoint(Frame.Width / 2, 50)
            };
            AddChild(_scoreLabel);
        }
示例#4
0
 /*
  * Sets up the start scene, which contains one "start" button
  */
 public override void DidMoveToView(SKView view)
 {
     //set the button size and position
     start.ScaleTo(new CGSize(width: 500, height: 400));
     start.Position = new CGPoint(Frame.Width / 2, Frame.Height / 2.5);
     AddChild(start); //add the node to the scene
 }
示例#5
0
        public override void DidMoveToView(SKView view)
        {
            // Setup your scene here
            RxSKLabelNode myLabel = RxSKLabelNode.FromFont("Chalkduster");

            myLabel.Text     = "Hello, World!";
            myLabel.FontSize = 65;
            myLabel.Position = new CGPoint(Frame.GetMidX(), Frame.GetMidY());
            myLabel.UserInteractionEnabled = true;

            AddChild(myLabel);

            myLabel.ObservableMouseClick()
            .Subscribe(e => Console.WriteLine("Label Clicked!"));

            RxNSButton myButton = new RxNSButton();

            myButton.Title = "Hello, World!";
            myButton.Frame = new CGRect(0, 0, 50, 30);
            this.View.AddSubview(myButton);
            myButton.ObservableClick()
            .Subscribe(e => Console.WriteLine("Button Clicked!"));


            this.ObservableKeyDown()
            .Subscribe(e => Console.WriteLine("chrs: {0}", e.Characters));

            this.ObservableMouseClick()
            //.Subscribe(e => Console.WriteLine("GameScene Clicked!"));
            .Subscribe(e => {
                Console.WriteLine("View clicked");
                CreateSprite(e.LocationInNode(this));
            });
        }
示例#6
0
        public override void DidMoveToView(SKView view)
        {
            // Якорь на середину сцены
            AnchorPoint = new CGPoint(0.5f, 0.5f);

            // Подсчитываем рамеры клетки с камешком. Клетки квадратные
            gemCellWidth  = ((float)Size.Width - (Properties.GameFieldPadding * 2)) / Level.ColumnsNumber;
            gemCellHeight = gemCellWidth;

            // Устанавливаем бэкграунд из текстуры
            background.Size      = Size;
            background.ZPosition = 1;
            AddChild(background);

            // добавляем на сцену основной нод игры, в который будут добавлены остальные элементы уровня
            gameLayer.ZPosition = 2;
            AddChild(gameLayer);

            // Расчет позиции нода с камешками в зависиомсти от высоты и ширины клетки и колисчества клеток
            CGPoint layerPosition = new CGPoint(-gemCellWidth * Level.ColumnsNumber / 2.0f, -gemCellHeight * Level.RowsNumber / 2.0f);

            // добавляем в основной нод нод для камешков
            gemLayer.Position  = layerPosition;
            gemLayer.ZPosition = 3;
            gameLayer.AddChild(gemLayer);
        }
示例#7
0
        public override void DidMoveToView(SKView view)
        {
            cameraNode    = new SKCameraNode();
            Camera        = cameraNode;
            Camera.XScale = 0.5f;
            Camera.YScale = 0.5f;
            AddChild(cameraNode);

            mapNode          = new MapNode(CurrentMap);
            mapNode.Position = new CGPoint(mapNode.Position.X, mapNode.Position.Y + 100);
            AddChild(mapNode);

            mapNode.MapClicked += HandleTouchOnMap;
            mapNode.AddCharacter(Player);

            var comp = (CharacterSpriteComponent)Player.GetComponent(typeof(CharacterSpriteComponent));

            comp.Direction = Direction.North;
            comp.Walking   = false;

            SetupItemPositions();
            SetupCharacterPositions();

            SetCameraConstraints(cameraNode, comp.Sprite);
        }
		public override void LoadView ()
		{
			View = new SKView ();

			if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0))
				EdgesForExtendedLayout = UIRectEdge.None;
		}
示例#9
0
        public override void DidMoveToView(SKView view)
        {
            BackgroundColor = UIColor.White;
            //AddAxes();

            PresentBVHMenu();
        }
        public override void DidFinishLaunching(NSNotification notification)
        {
            // Start the progress indicator animation.
            loadingProgressIndicator.StartAnimation(this);

            gameLogo.Image      = new NSImage(NSBundle.MainBundle.PathForResource("logo", "png"));
            archerButton.Image  = new NSImage(NSBundle.MainBundle.PathForResource("button_archer", "png"));
            warriorButton.Image = new NSImage(NSBundle.MainBundle.PathForResource("button_warrior", "png"));

            // The size for the primary scene - 1024x768 is good for OS X and iOS.
            var size = new CGSize(1024, 768);

            // Load the shared assets of the scene before we initialize and load it.
            scene = new AdventureScene(size);

            scene.LoadSceneAssetsWithCompletionHandler(() => {
                scene.Initialize();
                scene.ScaleMode = SKSceneScaleMode.AspectFill;

                SKView.PresentScene(scene);

                loadingProgressIndicator.StopAnimation(this);
                loadingProgressIndicator.Hidden = true;

                NSAnimationContext.CurrentContext.Duration    = 2.0f;
                ((NSButton)archerButton.Animator).AlphaValue  = 1.0f;
                ((NSButton)warriorButton.Animator).AlphaValue = 1.0f;

                scene.ConfigureGameControllers();
            });

            SKView.ShowsFPS       = true;
            SKView.ShowsDrawCount = true;
            SKView.ShowsNodeCount = true;
        }
示例#11
0
 public override void DidMoveToView(SKView view)
 {
     if (!contentCreated) {
         CreateSceneContents ();
         contentCreated = true;
     }
 }
示例#12
0
        public override void DidMoveToView(SKView view)
        {
            var messageLabel = new SKLabelNode
            {
                Text      = $"You {(isWin ? "win" : "loose")}",
                FontName  = "Arial",
                FontSize  = 40,
                FontColor = NSColor.Black,
                Position  = new CGPoint(Size.Width / 2, Size.Height - 100),
                ZPosition = 1
            };

            var PressAnykeyLabel = new SKLabelNode
            {
                Text      = $"Press any key for restart",
                FontName  = "Arial",
                FontSize  = 40,
                FontColor = NSColor.Black,
                Position  = new CGPoint(Size.Width / 2, 100),
                ZPosition = 1
            };

            AddChild(messageLabel);
            AddChild(PressAnykeyLabel);
        }
        /*
         * public override void TouchesBegan (NSSet touches, UIEvent e)
         * {
         *      base.TouchesBegan (touches, e);
         *
         *      UITouch touch = (UITouch)touches.AnyObject;
         *      PointF positionInScene = touch.LocationInNode (this);
         *      this.SelectNodeForTouch (positionInScene);
         * }
         *
         * public override void TouchesMoved(NSSet touches, UIEvent e)
         * {
         *      base.TouchesMoved (touches, e);
         *
         *      UITouch touch = (UITouch)touches.AnyObject;
         *      PointF positionInScene = touch.LocationInNode (this);
         *      PointF previousPosition = touch.PreviousLocationInNode (this);
         *
         *      PointF translation = new PointF (positionInScene.X - previousPosition.X, positionInScene.Y - previousPosition.Y);
         *      this.PanForTranslation (translation);
         * }
         */

        public override void DidMoveToView(SKView view)
        {
            base.DidMoveToView(view);

            UIPanGestureRecognizer gestureRecognizer = new UIPanGestureRecognizer(HandlePanFrom);

            this.View.AddGestureRecognizer(gestureRecognizer);
        }
示例#14
0
 public override void DidMoveToView(SKView view)
 {
     if (!contentCreated)
     {
         CreateSceneContents();
         contentCreated = true;
     }
 }
示例#15
0
 public override void DidMoveToView(SKView view)
 {
     // Setup your scene here
     memorySize       = 0;
     processSize      = 0;
     algorithm        = 0;
     currentProcessId = 0;
 }
示例#16
0
        public override void DidMoveToView(SKView view)
        {
            BackgroundColor = UIColor.White;

            map = new MinesweeperMap ();
            map.SetupBoard (AllLevels.GetFirstLevel ());

            DisplayMap ();
        }
        public override void LoadView()
        {
            View = new SKView();

            if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
            {
                EdgesForExtendedLayout = UIRectEdge.None;
            }
        }
        public override void LoadView()
        {
            base.LoadView ();

            View = new SKView {
                ShowsFPS = true,
                ShowsNodeCount = true,
                ShowsDrawCount = true
            };
        }
示例#19
0
 public override void DidMoveToView(SKView view)
 {
     // Setup your scene here
     player = new Player(Frame.Width, Frame.Height);
     AddChild(player.Sprite);
     infoLabel      = CreateInfoLabel();
     scoreLabel     = CreateScoreLabel();
     highscoreLabel = CreateHighscoreLabel();
     PhysicsWorld.DidBeginContact += DidBeginContact;
 }
        public static CoreGraphics.CGRect ConvertRectFromSceneToView(SKView View, float sceneMaxX, float sceneMaxY, float Width, float Height, float X, float Y)
        {
            float viewMaxY = (float)View.Frame.Height;
            float viewMaxX = (float)View.Frame.Width;

            float yFactor = viewMaxY / sceneMaxY;
            float xFactor = viewMaxX / sceneMaxX;

            CGRect res = new CGRect (X * xFactor, viewMaxY - ((Y + Height) * yFactor), Width * xFactor, Height * yFactor);
            return res;
        }
示例#21
0
        public override void DidMoveToView(SKView view)
        {
            // Setup your scene here
            var myLabel = SKLabelNode.FromFont("Chalkduster");

            myLabel.Text     = "Hello, World!";
            myLabel.FontSize = 65;
            myLabel.Position = new CGPoint(Frame.GetMidX(), Frame.GetMidY());

            AddChild(myLabel);
        }
示例#22
0
        public override void DidMoveToView(SKView view)
        {
            // Setup your scene here
            var myLabel = SKLabelNode.FromFont("Trebuchet MS");

            myLabel.Text     = "Starting..";
            myLabel.FontSize = 44;
            myLabel.Position = new CGPoint(Frame.GetMidX(), Frame.GetMidY());

            AddChild(myLabel);
        }
示例#23
0
        public override void DidMoveToView(SKView view)
        {
            // Setup your scene here
            var myLabel = new SKLabelNode("Chalkduster")
            {
                Text     = "Hello, World!",
                FontSize = 65,
                Position = new CGPoint(Frame.Width / 2, Frame.Height / 2)
            };

            AddChild(myLabel);
        }
示例#24
0
        public override void DidMoveToView(SKView view)
        {
            // Setup your scene here
            BackgroundColor = new UIKit.UIColor(.15f, .15f, .3f, 1);
            var myLabel = new SKLabelNode("Chalkduster")
            {
                FontSize = 30,
                Text     = "Hello, World!",
                Position = new CGPoint(Frame.GetMidX(), Frame.GetMidY())
            };

            AddChild(myLabel);
        }
示例#25
0
        public override void DidMoveToView(SKView view)
        {
            _windowWidth  = view.Window.Frame.Width;
            _windowHeight = view.Window.Frame.Height;

            // Initialize camera
            Camera = new SKCameraNode()
            {
                Position = new CGPoint(_windowWidth / 2, _windowHeight / 2)
            };

            RenderScene();
        }
示例#26
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var scene = ShaderScene.Random(3);

            var skView = new SKView(View.Frame)
            {
                ShowsFPS = true, PreferredFramesPerSecond = 120
            };

            View.AddSubview(skView);
            skView.PresentScene(scene);
        }
示例#27
0
        public override void DidMoveToView(SKView view)
        {
            //Load in the "table top"
            SKSpriteNode background = SKSpriteNode.FromImageNamed(NSBundle.MainBundle.PathForResource("bg_1", "jpg"));

            background.Position = new CGPoint(Frame.GetMidX(), Frame.GetMidY());
            background.ScaleTo(Frame.Size);
            background.ZPosition = -1000;
            AddChild(background);



            DealCards();
        }
        public override void LoadView()
        {
            base.LoadView ();
            View = skView = new SKView {
                ShowsFPS = true,
                ShowsNodeCount = true,
                Frame = View.Frame,
            };

            var scene = new MyScene (View.Bounds.Size) {
                ScaleMode = SKSceneScaleMode.AspectFill
            };

            skView.PresentScene (scene);
        }
示例#29
0
        public override void DidMoveToView(SKView view)
        {
            // Setup your scene here
            p1.Position  = new CGPoint(Frame.Size.Width / 2, 155 * (Frame.Size.Height / 300));
            p1.ZPosition = 1;

            BackgroundColor = NSColor.Black;

            bg.Position = new CGPoint(XScale = Frame.Size.Width / 2, YScale = Frame.Size.Height / 2);
            bg.Size     = new CGSize(Frame.Size.Height, Frame.Size.Height);
            p1.Size     = new CGSize(Frame.Size.Height / 10, Frame.Size.Height / 10);

            AddChild(bg);
            AddChild(p1);
        }
示例#30
0
        public override void LoadView()
        {
            base.LoadView();
            View = skView = new SKView {
                ShowsFPS       = true,
                ShowsNodeCount = true,
                Frame          = View.Frame,
            };

            var scene = new MyScene(View.Bounds.Size)
            {
                ScaleMode = SKSceneScaleMode.AspectFill
            };

            skView.PresentScene(scene);
        }
示例#31
0
        public override void DidMoveToView(SKView view)
        {
            // Setup your scene here
            var myLabel = new SKLabelNode("ArialMT")
            {
                Text     = "Can change text and bgcolor",
                FontSize = 50,
                Position = new CGPoint(Frame.Width / 2, Frame.Height / 2)
            };

            //BackgroundColor = NSColor.Black;
            bg.Position = new CGPoint(XScale = Frame.Size.Width / 2, YScale = Frame.Size.Height / 2);

            AddChild(bg);
            AddChild(myLabel);
        }
示例#32
0
        public override void DidMoveToView(SKView view)
        {
            base.DidMoveToView(view);

            var obstacles = new [] {
                AddObstacle(new CGPoint(Frame.GetMidX(), Frame.GetMidY() + 150f)),
                AddObstacle(new CGPoint(Frame.GetMidX() - 200f, Frame.GetMidY() - 150f)),
                AddObstacle(new CGPoint(Frame.GetMidX() + 200f, Frame.GetMidY() - 150f))
            };

            Player = new AgentNode(this, DefaultAgentRadius, new CGPoint(Frame.GetMidX(), Frame.GetMidY()));
            Player.Agent.Behavior = new GKBehavior();
            AgentSystem.AddComponent(Player.Agent);
            SeekGoal = GKGoal.GetGoalToSeekAgent(TrackingAgent);
            Player.Agent.Behavior.SetWeight(100, GKGoal.GetGoalToAvoidObstacles(obstacles, 1));
        }
示例#33
0
        public override void DidMoveToView(SKView view)
        {
            base.DidMoveToView (view);

            var obstacles = new [] {
                AddObstacle (new CGPoint (Frame.GetMidX (), Frame.GetMidY () + 150f)),
                AddObstacle (new CGPoint (Frame.GetMidX () - 200f, Frame.GetMidY () - 150f)),
                AddObstacle (new CGPoint (Frame.GetMidX () + 200f, Frame.GetMidY () - 150f))
            };

            Player = new AgentNode (this, DefaultAgentRadius, new CGPoint (Frame.GetMidX (), Frame.GetMidY ()));
            Player.Agent.Behavior = new GKBehavior ();
            AgentSystem.AddComponent (Player.Agent);
            SeekGoal = GKGoal.GetGoalToSeekAgent (TrackingAgent);
            Player.Agent.Behavior.SetWeight (100, GKGoal.GetGoalToAvoidObstacles (obstacles, 1));
        }
        public override void ViewWillLayoutSubviews()
        {
            base.ViewWillLayoutSubviews();

            // Configure the view
            SKView skView = (SKView)this.View;

            if (skView.Scene == null)
            {
                // Create and configure the scene
                SKScene scene = new MyScene(skView.Bounds.Size);
                scene.ScaleMode = SKSceneScaleMode.AspectFill;

                // Present the scene
                skView.PresentScene(scene);
            }
        }
示例#35
0
        public override void DidMoveToView(SKView view)
        {
                        #if TARGET_OS_MAC
            var fontName = NSFont.SystemFontOfSize(65).FontName;
            var label    = SKLabelNode.FromFont(fontName);
            label.Text     = SceneName;
            label.FontSize = 65;
            label.HorizontalAlignmentMode = SKLabelHorizontalAlignmentMode.Left;
            label.VerticalAlignmentMode   = SKLabelVerticalAlignmentMode.Top;
            label.Position = new CGPoint(Frame.GetMinX() + 10, Frame.GetMaxY() - 46);
            AddChild(label);
                        #endif

            AgentSystem            = new GKComponentSystem <GKAgent2D> ();
            TrackingAgent          = new GKAgent2D();
            TrackingAgent.Position = new Vector2((float)Frame.GetMidX(), (float)Frame.GetMidY());
        }
示例#36
0
        public override void DidMoveToView(SKView view)
        {
            // Setup your scene here

            // test values for position
            player1.xPos = 0; player1.yPos = 0; player1.zPos = 0;
            fetch.setPos(ref player1, ref sprites, Height, Width);

            sprites = data.fetchMap("map4");
            data.Add_map(sprites);
            // Fetches data from the stored map and implements it into the game
            sprites = data.Getmap(Height, Width, 3);
            //sprites = data.fetchMap(Height, Width, "map1");
            player1.spriteNode.ZPosition = 1;

            BackgroundColor = NSColor.Black;

            bg.Position = new CGPoint(XScale = Frame.Width / 2, YScale = Frame.Height / 2);
            bg.Size     = new CGSize(Height, Height);
            Debug.WriteLine("background: ");
            Debug.WriteLine(bg.Size);
            Debug.WriteLine(Frame.Size.Height);
            //player1.spriteNode.Size = new CGSize(Frame.Size.Height / 10, Frame.Size.Height / 10);

            AddChild(bg);
            AddChild(player1.spriteNode);
            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    Debug.WriteLine(sprites[i, j, 0]);
                    if (sprites[i, j, 0] != null)
                    {
                        AddChild(sprites[i, j, 0].spriteNode);
                    }
                }
            }

            /*
             * AddChild(block1.spriteNode);
             * AddChild(step1.spriteNode);
             * AddChild(block2.spriteNode);
             * AddChild(step2.spriteNode);
             */
        }
示例#37
0
        public override void DidMoveToView(SKView view)
        {
            var bgNode = SKSpriteNode.FromImageNamed("bg.jpg");
            var scale  = Size.Width / bgNode.Size.Width;

            bgNode.SetScale(scale * 2);
            bgNode.Position = new CGPoint(Size.Width / 2, Size.Height / 2);
            AddChild(bgNode);
            bgNode.ZPosition = -1;

            PhysicsWorld.Gravity = new CGVector(0, 0);
            GC = new GameController(this);
            GC.SpawnPlayer();
            var colDelegate = new CollisionDelegate();

            colDelegate.Callbacks       += NodesCollided;
            PhysicsWorld.ContactDelegate = colDelegate;
        }
        public SKViewRenderer(SKView view, Context context) : base(context)
        {
            _skView              = view;
            PaintSurface        += OnPaint;
            _skView.Invalidated += OnViewInvalidated;
            this.Touch          += (s, e) =>
            {
                if (e.Event.Action != global::Android.Views.MotionEventActions.Up)
                {
                    return;
                }

                _skView.HandleTouch(new TouchData()
                {
                    Action = e.Event.Action == global::Android.Views.MotionEventActions.Up ? TouchAction.Tap : TouchAction.None,
                    Point  = new Point(e.Event.RawX, e.Event.RawY)
                });
            };
        }
示例#39
0
        public override void DidMoveToView(SKView view)
        {
            base.DidMoveToView (view);

            var agents = new List<GKAgent2D> (20);
            const int agentsPerRow = 4;
            for (int i = 0; i < agentsPerRow * agentsPerRow; i++) {
                var x = Frame.GetMidX () + i % agentsPerRow * 20;
                var y = Frame.GetMidY () + i / agentsPerRow * 20;
                var boid = new AgentNode (this, 10, new CGPoint (x, y));
                AgentSystem.AddComponent (boid.Agent);
                agents.Add (boid.Agent);
                boid.DrawsTail = false;
            }

            const float separationRadius = 0.553f * 50;
            const float separationAngle = (float)(3 * Math.PI / 4.0f);
            const float separationWeight = 10.0f;

            const float alignmentRadius = 0.83333f * 50;
            const float alignmentAngle = (float)(Math.PI / 4.0f);
            const float alignmentWeight = 12.66f;

            const float cohesionRadius = 1.0f * 100;
            const float cohesionAngle = (float)(Math.PI / 2.0f);
            const float cohesionWeight = 8.66f;

            // Separation, alignment, and cohesion goals combined cause the flock to move as a group.
            var behavior = new GKBehavior ();
            behavior.SetWeight (separationWeight, GKGoal.GetGoalToSeparate (agents.ToArray (), separationRadius, separationAngle));
            behavior.SetWeight (alignmentWeight, GKGoal.GetGoalToAlign (agents.ToArray (), alignmentRadius, alignmentAngle));
            behavior.SetWeight (cohesionWeight, GKGoal.GetGoalToCohere (agents.ToArray (), cohesionRadius, cohesionAngle));

            foreach (GKAgent2D agent in agents)
                agent.Behavior = behavior;

            SeekGoal = GKGoal.GetGoalToSeekAgent (TrackingAgent);
        }
示例#40
0
        public override void DidMoveToView(SKView view)
        {
            base.DidMoveToView (view);

            var follower = new AgentNode (this, DefaultAgentRadius, new CGPoint (Frame.GetMidX (), Frame.GetMidY ())) {
                Color = SKColor.Cyan
            };

            var center = new Vector2 ((float)Frame.GetMidX (), (float)Frame.GetMidY ());
            var points = new [] {
                new Vector2 (center.X, center.Y + 50),
                new Vector2 (center.X + 50, center.Y + 150),
                new Vector2 (center.X + 100, center.Y + 150),
                new Vector2 (center.X + 200, center.Y + 200),
                new Vector2 (center.X + 350, center.Y + 150),
                new Vector2 (center.X + 300, center.Y),
                new Vector2 (center.X, center.Y - 200),
                new Vector2 (center.X - 200, center.Y - 100),
                new Vector2 (center.X - 200, center.Y),
                new Vector2 (center.X - 100, center.Y + 50),
            };

            var path = GKPath.FromPoints (points, DefaultAgentRadius, true);

            follower.Agent.Behavior = GKBehavior.FromGoal (GKGoal.GetGoalToFollowPath (path, 1.5, true), 1);
            AgentSystem.AddComponent (follower.Agent);

            var cgPoints = new CGPoint[11];
            for (var i = 0; i < 10; i++)
                cgPoints [i] = new CGPoint (points [i].X, points [i].Y);

            cgPoints [10] = cgPoints [0];
            var pathShape = SKShapeNode.FromPoints (ref cgPoints [0], 11);
            pathShape.LineWidth = 2;
            pathShape.StrokeColor = SKColor.Magenta;
            AddChild (pathShape);
        }
示例#41
0
 public override void DidMoveToView(SKView view)
 {
     authForm = new AuthorizationForm (this.Game, this, onAutorizationFormClose, null);
     authForm.Show (1344, 750, 0, 0);
     ChangeActiveForm (authForm);
 }
示例#42
0
 public override void LoadView()
 {
     // Let our view be an SKView.
     var skView = new SKView ();
     this.View = skView;
 }
示例#43
0
		public override void LoadView ()
		{
			View = new SKView ();
		}
 public override void DidMoveToView(SKView view)
 {
     // Setup your scene here
     //UITextField myTextFiel = new UITextField (new CGRect (100, 100, 200, 200));
     //this.View.Add (myTextFiel);
 }
示例#45
0
 public GameGraphics(Game Game, SKView GameView)
 {
     this.Game = Game;
     this.GameView = GameView;
 }
示例#46
0
        public override void DidMoveToView(SKView view)
        {
            #if TARGET_OS_MAC
            var fontName = NSFont.SystemFontOfSize (65).FontName;
            var label = SKLabelNode.FromFont (fontName);
            label.Text = SceneName;
            label.FontSize = 65;
            label.HorizontalAlignmentMode = SKLabelHorizontalAlignmentMode.Left;
            label.VerticalAlignmentMode = SKLabelVerticalAlignmentMode.Top;
            label.Position = new CGPoint (Frame.GetMinX () + 10, Frame.GetMaxY () - 46);
            AddChild (label);
            #endif

            AgentSystem = new GKComponentSystem (typeof(GKAgent2D));
            TrackingAgent = new GKAgent2D ();
            TrackingAgent.Position = new Vector2 ((float)Frame.GetMidX (), (float)Frame.GetMidY ());
        }