public new static void LoadSharedAssetsOnce() { #if __IOS__ var whiteColor = UIColor.White; #else NSColor whiteColor = null; new NSObject().InvokeOnMainThread(() => { whiteColor = NSColor.White; }); #endif sharedProjectile = SKSpriteNode.FromColor(whiteColor, new CGSize(2, 24)); sharedProjectile.PhysicsBody = SKPhysicsBody.CreateCircularBody(ProjectileCollisionRadius); sharedProjectile.Name = @"Projectile"; sharedProjectile.PhysicsBody.CategoryBitMask = (uint)ColliderType.Projectile; sharedProjectile.PhysicsBody.CollisionBitMask = (uint)ColliderType.Wall; sharedProjectile.PhysicsBody.ContactTestBitMask = sharedProjectile.PhysicsBody.CollisionBitMask; sharedProjectileEmitter = GraphicsUtilities.EmitterNodeWithEmitterNamed("ArcherProjectile"); sharedIdleAnimationFrames = GraphicsUtilities.LoadFramesFromAtlas("Archer_Idle", "archer_idle_", DefaultNumberOfIdleFrames); sharedWalkAnimationFrames = GraphicsUtilities.LoadFramesFromAtlas("Archer_Walk", "archer_walk_", DefaultNumberOfWalkFrames); sharedAttackAnimationFrames = GraphicsUtilities.LoadFramesFromAtlas("Archer_Attack", "archer_attack_", ArcherAttackFrames); sharedGetHitAnimationFrames = GraphicsUtilities.LoadFramesFromAtlas("Archer_GetHit", "archer_getHit_", ArcherGetHitFrames); sharedDeathAnimationFrames = GraphicsUtilities.LoadFramesFromAtlas("Archer_Death", "archer_death_", ArcherDeathFrames); sharedDamageAction = SKAction.Sequence(new [] { SKAction.ColorizeWithColor(whiteColor, 10, 0), SKAction.WaitForDuration(0.75), SKAction.ColorizeWithColorBlendFactor(0, 0.25) }); }
public SpriteKitOverlayScene(CGSize size) { Size = size; AnchorPoint = new CGPoint(0.5f, 0.5f); ScaleMode = SKSceneScaleMode.ResizeFill; //buttons NextButton = SKSpriteNode.FromImageNamed(NSBundle.MainBundle.PathForResource("images/next", "png")); var marginY = 60.0f; var maringX = -60.0f; #if __IOS__ if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) { marginY = 30; } #endif NextButton.Position = new CGPoint(size.Width * 0.5f + maringX, -size.Height * 0.5f + marginY); NextButton.Name = "next"; NextButton.Alpha = 0.01f; #if __IOS__ if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) { NextButton.XScale = NextButton.YScale = 0.5f; } #endif AddChild(NextButton); #if __IOS__ PreviousButton = SKSpriteNode.FromColor(UIColor.Clear, NextButton.Frame.Size); #else PreviousButton = SKSpriteNode.FromColor(NSColor.Clear, NextButton.Frame.Size); #endif PreviousButton.Position = new CGPoint(-(size.Width * 0.5f + maringX), -size.Height * 0.5f + marginY); PreviousButton.Name = "back"; PreviousButton.Alpha = 0.01f; AddChild(PreviousButton); }
public void SetupScene() { BackgroundColor = UIColor.White; playButton.Text = "Play!"; playButton.FontColor = UIColor.White; playButton.FontName = "GillSans-Bold"; playButton.FontSize = 30; playButton.Position = new CGPoint(Size.Width / 2, Size.Height / 8f); textScaling(playButton); AddChild(playButton); rowColour = SKSpriteNode.FromColor(UIColor.Orange, new CGSize(Size.Width, 50)); rowColour.Hidden = true; HLabelLevel.FontName = "GillSans-Bold"; HLabelLevel.FontSize = 25; HLabelLevel.FontColor = UIColor.White; HLabelScore.FontName = "GillSans-Bold"; HLabelScore.FontSize = 25; HLabelScore.FontColor = UIColor.White; _menuButton.Position = new CGPoint(Size.Width / 6, Size.Height - 55); HLabelLevel.Position = new CGPoint(Size.Width / 2, Size.Height / 1.25f); HLabelScore.Position = new CGPoint(Size.Width / 2, Size.Height / 1.36f); AddChild(rowColour); AddChild(HLabelLevel); AddChild(HLabelScore); AddChild(_menuButton); }