public PlayerRow(Player player) { this.player = player; AddChild(inner = new FContainer()); inner.AddChild(iconContainer = new FContainer()); if(player.device.Name == "TOKeyboardProfileA") { icon = new FSprite("UI/WASDIcon"); } else if(player.device.Name == "TOKeyboardProfileB") { icon = new FSprite("UI/ArrowsIcon"); } else { icon = new FSprite("UI/ControllerIcon"); } icon.color = player.color.color; iconContainer.AddChild(icon); iconContainer.scale = 0; Go.to(iconContainer, 0.4f, new TweenConfig().scaleXY(1.0f).backOut()); ListenForUpdate(Update); }
public ScoreBox(Slot slot) { this.slot = slot; mathMode = new RXTweenable(0.0f,HandleMathModeChange); base.Init(slot.player); contentContainer.AddChild(_scoreLabel = new FLabel("Raleway","")); _scoreLabel.color = Color.black; _baseLabel = new FLabel("Raleway","123"); _baseLabel.color = Color.black; _deltaLabel = new FLabel("Raleway","22"); _deltaLabel.color = Color.black; _signIcon = new FSprite("Icons/Plus"); _signIcon.color = Color.black; _equalsIcon = new FSprite("Icons/Equals"); _equalsIcon.color = Color.black; _skullSprite = new FSprite("Icons/Skull"); _skullSprite.color = Color.black; slot.player.SignalScoreChange += HandleScoreChange; ListenForUpdate(HandleUpdate); HandleMathModeChange(); HandleScoreChange(); }
public WTSpriteComponent(string name, FSprite sprite) : base(name) { componentType_ = ComponentType.Sprite; sprite_ = sprite; }
public PlayerSelectPage() { bg = new FSprite("Arena/BG_1"); bg.color = new Color(0.5f,0.5f,0.5f,1.0f); AddChild(bg); statusLabel = new DualLabel(TOFonts.MEDIUM_BOLD,""); statusLabel.scale = 1f; statusLabel.SetPosition(0,-Config.HEIGHT/2+27); AddChild(statusLabel); float spreadControlX = Config.WIDTH/2 - 74.0f; DualLabel wolfLabel = new DualLabel(TOFonts.MEDIUM_BOLD,"WOLF (night):\n\nTAP ANY BUTTON\nTO ATTACK\n\n\nHUMAN (day):\n\nRUN FOR\nYOUR LIFE"); wolfLabel.mainLabel.color = new Color(1.0f,0.7f,0.7f); wolfLabel.x = -spreadControlX; AddChild(wolfLabel); DualLabel villLabel = new DualLabel(TOFonts.MEDIUM_BOLD,"VILLAGERS:\n\nRUN AWAY\nAT NIGHT\n\nHOLD ANY BUTTON\nTO SPREAD OUT\n\nCAN HOP\nOVER FENCES"); villLabel.mainLabel.color = new Color(0.8f,0.8f,1.0f); villLabel.x = spreadControlX; AddChild(villLabel); logo = new FSprite("Arena/Logo"); AddChild(logo); logo.y = Config.HEIGHT/2 - 43.0f; ListenForUpdate(Update); UpdateStatus(); }
public LungLevel() { background_ = new FAnimatedSprite("Lungs_Background"); int[] breathing_frames = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; FAnimation breathing_animation = new FAnimation("breathing", "Lungs_Background", breathing_frames, 250, true); background_.addAnimation(breathing_animation); background_.play("breathing"); AddChild(background_); dust_container_size_ = new Rect(-Futile.screen.halfWidth*2.5f, -Futile.screen.halfHeight*2.5f, Futile.screen.width*2.5f, Futile.screen.height*2.5f); dust1_ = new Dust("Dust_4", dust_container_size_); AddChild(dust1_); tubes1_ = new FSprite("Lungs_Rear"); AddChild(tubes1_); tubes2_ = new FSprite("Lungs_MidBack1"); AddChild(tubes2_); dust2_ = new Dust("Dust_3", dust_container_size_); AddChild(dust2_); tubes3_ = new FSprite("Lungs_MiddleFore"); AddChild(tubes3_); tubes4_ = new FSprite("Lungs_Fore"); AddChild(tubes4_); dust3_ = new Dust("Dust_2", dust_container_size_); AddChild(dust3_); }
public override void Start() { background_ = new FSprite("level select screen final"); AddChild(background_); string highest_level = PlayerPrefs.GetString("highest_level"); if(highest_level.Equals("stomach")) { setBrain(ButtonType.locked); setLungs(ButtonType.locked); } else if(highest_level.Equals("lung")) { setBrain(ButtonType.locked); setLungs(ButtonType.normal); } else { setBrain(ButtonType.normal); setLungs(ButtonType.normal); } stomach = new FButton("Stomach", "StomachPressed"); stomach.SignalRelease += HandleStomachButton; AddChild(stomach); stomach.SetPosition(STOMACH_POSITION); background_.scale = 1f; Go.to(background_, 0.5f, new TweenConfig().setDelay(0.1f).floatProp("scale", 1.0f).setEaseType(EaseType.BackOut)); }
public TeamPanel(Team team) { this.team = team; team.SignalTeamChange += HandleSignalPlayerChange; fullWidth = GameConfig.WINNING_SCORE * WIDTH_PER_NIB; bg = new FSliceSprite("PointBarBG", fullWidth+6.0f, 30.0f, 0, 10, 0, 10); AddChild(bg); bg.color = team.color; goldBG = new FSliceSprite("PointBarBGGold", fullWidth+6.0f, 30.0f, 0, 10, 0, 10); AddChild(goldBG); goldBG.alpha = 0.66f; goldBG.isVisible = false; for(int p = 0; p<GameConfig.WINNING_SCORE; p++) { FContainer nib = new FContainer(); nib.x = -fullWidth*0.5f + 15.0f + p * WIDTH_PER_NIB; nib.y = 0; FSprite bgSprite = new FSprite("PointBarNibBG"); bgSprite.color = team.color; nib.AddChild(bgSprite); AddChild(nib); nibs.Add(nib); } ListenForUpdate(HandleUpdate); }
public WTSpriteComponent(string name, string imageName) : base(name) { componentType_ = ComponentType.Sprite; sprite_ = new FSprite(imageName); }
public TweenTerrain() { height = 768; width = 768; halfWidth = width/2; halfHeight = height/2; TextAsset t = Resources.Load("map") as TextAsset; IDictionary dict = Json.Deserialize(t.text) as IDictionary; IList layers = dict["layers"] as IList; IDictionary layer = layers[0] as IDictionary; IList data = layer["data"] as IList; int index = 0; tiles = new FSprite[((int)height+tileSize)/tileSize,((int)width+tileSize)/tileSize]; for(float y = -halfHeight; y < halfHeight; y+=tileSize){ for(float x = -halfWidth; x < halfWidth; x+=tileSize){ FSprite s = new FSprite(Futile.whiteElement); if((long)data[index++] == 1) enablesTiles.Add(s); s.SetPosition(x,y); s.scale = 0; s.alpha = 0; tiles[(int)(y+halfHeight)/tileSize,(int)(x+halfWidth)/tileSize] = s; this.AddChild(s); } } Debug.Log(index); }
public FButton (string upElementName, string downElementName, string overElementName, string clickSoundName) { _upElement = Futile.atlasManager.GetElementWithName(upElementName); _downElement = Futile.atlasManager.GetElementWithName(downElementName); if(overElementName != null) { _overElement = Futile.atlasManager.GetElementWithName(overElementName); _supportsOver = true; } _sprite = new FSprite(_upElement.name); _sprite.anchorX = _anchorX; _sprite.anchorY = _anchorY; AddChild(_sprite); _hitRect = _sprite.textureRect; _clickSoundName = clickSoundName; EnableSingleTouch(); if(_supportsOver) { ListenForUpdate(HandleUpdate); } }
public Arena() { instance = this; mapData = MapGenerator.Generate(); FSprite bgSprite = new FSprite("Arena/BG_1"); AddChild(bgSprite); AddChild(entityArea = new EntityArea()); float inset = 13; entityArea.bounds.x = -Config.WIDTH/2 + inset; entityArea.bounds.y = -Config.HEIGHT/2 + inset; entityArea.bounds.width = Config.WIDTH - inset*2; entityArea.bounds.height = Config.HEIGHT - inset*2; colorOverlay = new FSprite("WhiteBox"); colorOverlay.color = new Color(1,1,1,0); colorOverlay.width = Config.WIDTH; colorOverlay.height = Config.HEIGHT; entityArea.overlayContainer.AddChild(colorOverlay); AddChild(frontContainer = new FContainer()); dayManager = new DayManager(); CreateBuildings(); SetupPlayers(); ListenForUpdate(Update); }
// Use this for initialization public override void Start() { transitionIn = true; InitScript.inGame = false; background = new Starfield(InitScript.bg1Pos,false); Futile.stage.AddChild(background); background2 = new Starfield(InitScript.bg2Pos, false); Futile.stage.AddChild(background2); menuAnims = new FSprite("MenutoCredits0.png"); menuAnims.scale = 2.0f; menuAnims.x = 0; //menuAnims.isVisible = false; Futile.stage.AddChild(menuAnims); menuBackground = new FSprite("CreditScreen.png"); menuBackground.scale = 2.0f; menuBackground.x = 0; menuBackground.isVisible = false; Futile.stage.AddChild(menuBackground); btnInstructions = new FButton("MenuButton.png"); btnInstructions.x -= 1; btnInstructions.y -= 166; btnInstructions.scale = 2.0f; btnInstructions.isVisible = false; Futile.stage.AddChild(btnInstructions); InitScript.blackBar1.MoveToTop(); InitScript.blackBar2.MoveToTop(); btnInstructions.SignalRelease += HandleInfoButtonRelease; Futile.instance.SignalUpdate += HandleUpdate; }
public HumanDeathCloud(Human human) : base(human.entityArea) { this.human = human; this.x = human.x; this.y = human.y+4; frames = new FAtlasElement[] { Futile.atlasManager.GetElementWithName("Arena/Vill_Death1"), Futile.atlasManager.GetElementWithName("Arena/Vill_Death2"), Futile.atlasManager.GetElementWithName("Arena/Vill_Death3"), Futile.atlasManager.GetElementWithName("Arena/Vill_Death4") }; cloudHolder = new FContainer(); cloudSprite = new FSprite(frames[0]); cloudSprite.scaleX = RXRandom.Bool() ? -1f : 1f; cloudHolder.AddChild(cloudSprite); cloudSprite.shader = FShader.Additive; cloudSprite.alpha = RXRandom.Range(0.8f,0.9f); cloudSprite.color = human.player.player.color.color + new Color(0.1f,0.1f,0.1f,0.0f); cloudSprite.scale = 2.0f; graveHolder = new FContainer(); graveSprite = new FSprite("Arena/Human_Grave_1"); graveHolder.AddChild(graveSprite); graveSprite.color = human.player.player.color.color + new Color(0.5f,0.5f,0.5f); graveSprite.y = 16; Update(); }
public StateGame() : base(GAME) { //Initialize m_ScoreCounterTimers = new List<float>(); m_HealthCounterTimers = new List<float>(); m_HealthChanges = new List<float>(); m_EnemyShootTimer = new List<float>(); m_Started = false; m_ConsoleLog = new string[CONSOLE_MAX_LINE]; for(int i=0;i<CONSOLE_MAX_LINE;i++) m_ConsoleLog[i] = ""; //Create backgrounds m_Background11 = new FSprite("clouds") { x = Constants.UNITY_CENTER_X, y = Constants.UNITY_CENTER_Y }; m_Background12 = new FSprite("clouds") { x = Constants.UNITY_CANVAS_RIGHT + (Constants.UNITY_CANVAS_WIDTH / 2f) - 1, y = Constants.UNITY_CENTER_Y }; m_Background22 = new FSprite("hills") { x = Constants.UNITY_CANVAS_RIGHT + (Constants.UNITY_CANVAS_WIDTH / 2f) - 1 }; m_Background21 = new FSprite("hills") { x = Constants.UNITY_CENTER_X }; m_Background21.y = Constants.UNITY_CANVAS_BOTTOM + m_Background21.textureRect.height * 0.5f; m_Background22.y = Constants.UNITY_CANVAS_BOTTOM + m_Background22.textureRect.height * 0.5f; AddChild(m_Background11); AddChild(m_Background12); AddChild(m_Background21); AddChild(m_Background22); //Create components m_Exa = new Exa(); m_Enemies = new FContainer(); m_EnemyBullets = new FContainer(); m_PlayerBullets = new FContainer(); AddChild(m_Enemies); AddChild(m_Exa); AddChild(m_PlayerBullets); AddChild(m_EnemyBullets); //Create interface m_ScoreCounter = new FLabel("font", "") { isVisible = false }; m_ErrorCounter = new FLabel("font", "") { isVisible = false }; m_ScoreOverlay = new FSprite("target") { isVisible = false }; m_HealthOverlay = new FSprite("target") { isVisible = false }; m_HealthGauge = new FSprite("gauge") { isVisible = false }; m_HealthBar = new FSprite("rect") { isVisible = false, color = new Color(0, 1, 0, 1) }; //Add AddChild(m_HealthBar); AddChild(m_HealthGauge); //AddChild(m_ErrorCounter); AddChild(m_ScoreCounter); AddChild(m_ScoreOverlay); AddChild(m_HealthOverlay); //Create unity canvas m_Unity = new FSprite("unity") { x = Futile.screen.halfWidth, y = Futile.screen.halfHeight }; m_Console = new FLabel[CONSOLE_MAX_LINE]; for(int i=0;i<CONSOLE_MAX_LINE;i++) m_Console[i] = new FLabel("font_console", "") { isVisible = false }; //Add AddChild(m_Unity); foreach(FLabel line in m_Console) AddChild(line); }
public SBSpriteComponent(string imageName, bool ableToRotate) { this.shouldBeInRotatingContainer = ableToRotate; sprite = new FSprite(imageName); componentType = ComponentType.Sprite; name = "sprite component"; }
public ResetBox() { base.Init(Player.NullPlayer); contentContainer.AddChild(iconSprite = new FSprite("Icons/Reset")); contentSprites.Add(iconSprite); iconSprite.color = Color.black; }
void Start() { FutileParams fparms = new FutileParams(true,true,false,false); fparms.AddResolutionLevel(480.0f,1.0f,1.0f,"_Scale1"); fparms.origin = new Vector2(0.5f,0.5f); Futile.instance.Init(fparms); Futile.atlasManager.LoadAtlas("Atlases/Physics"); FSprite rigidBox = new FSprite("box.png"); Futile.stage.AddChild(rigidBox); new FPRigidBody(rigidBox); FSprite staticBody = new FSprite("box.png"); staticBody.y = staticBody.y - 100.0f; Futile.stage.AddChild(staticBody); new FPStaticBody(staticBody); for(int x = 0; x< 100; x++) { FSprite ball = new FSprite("ball.png"); ball.y = ball.y + 170.0f; ball.x = Random.Range(-Screen.width/4, Screen.width/4); ball.width = 10; ball.height = 10; Futile.stage.AddChild(ball); FPRigidBody ballBody = new FPRigidBody(ball, FPRigidBody.BodyShape.CIRCLE); ballBody.velocity = new Vector3(0.0f, -50.0f,0.0f); } FPhysics.instance.Init(true,true,true,true); FPhysics.instance.gravity = new Vector3(0.0f,-9.8f,0.0f); }
public LevelBar(int numDashes) { this.numDashes = numDashes; string borderElementName = "UI/Stats/LevelBar_" + numDashes; if (numDashes == 5) { dashWidth = 19; } else if (numDashes == 10) { dashWidth = 9; } else if (numDashes == 25) { dashWidth = 3; } AddChild (barContainer = new FContainer ()); barContainer.AddChild (background = new FSprite ("Box")); //black bg background.color = Color.black; background.SetAnchor (0.0f, 0.0f); barContainer.AddChild (borderSprite = new FSprite (borderElementName));//white border borderSprite.SetAnchor (0.0f, 0); borderSprite.SetPosition (0, 0); barContainer.AddChild (dashContainer = new FContainer ()); dashSpacing = 1; totalWidth = 100; dashHeight = 3; barOffset = new Vector2 (-51, 0); dashOffset = new Vector2 (1, 2); ApplyConfig (); }
public FutilePlatformerBaseObject(RXRect hitBox, World world, string shadow ="") { this.ySetsSortZ = true; this.hitBox = hitBox; this.world = world; this.tileSize = world.TileSize; if (C.isDebug) { collisionDebugSprite = new FSprite("boundingBox"); collisionDebugSprite.x = hitBox.x; collisionDebugSprite.y = hitBox.y; collisionDebugSprite.width = hitBox.width; collisionDebugSprite.height = hitBox.height; collisionDebugSprite.sortZ = 100; this.AddChild(collisionDebugSprite); } this.shouldSortByZ = true; if (!String.IsNullOrEmpty(shadow)) { this.shadow = new FSprite(shadow); this.shadow.y = -.1f; this.AddChild(this.shadow); } UpdateCollisionChecks(); }
public StomachLevel() { lake_sprite_ = new FSprite("stomach_back"); cave_sprite_ = new FSprite("stomach_mid"); bubbles_container_ = new FParallaxContainer(); foreground_ = new FSprite("stomach_fore"); background = new FParallaxContainer(); stomachCave = new FParallaxContainer(); foreground = new FParallaxContainer(); background.AddChild (lake_sprite_); stomachCave.AddChild (cave_sprite_); foreground.AddChild (foreground_); background.setSize (new Vector2 (Futile.screen.width * 1.5f, Futile.screen.height * 1.5f)); bubbles_container_.setSize(new Vector2 (Futile.screen.width *1.5f, Futile.screen.height * 1.5f)); foreground.setSize (new Vector2 (Futile.screen.width * 2f, Futile.screen.height * 2f)); AddChild(background); AddChild(stomachCave); AddChild(bubbles_container_); AddChild(foreground); bubble_container_size_ = new Rect(-Futile.screen.halfWidth*.75f, -Futile.screen.halfHeight*.75f, Futile.screen.width*.75f, Futile.screen.halfHeight*.75f); stomach_bubbles_ = new List<StomachBubble>(); }
public UI() { dialogue = new Dialogue(); this.AddChild(dialogue); background = new FSprite("bg"); slotA = new FSprite("slot_a"); slotB = new FSprite("slot_b"); slotASelected = new FSprite("jump_soul"); slotBSelected = new FSprite("sword_soul"); hearts = new FSprite("heart_full"); this.AddChild(background); this.AddChild(slotA); this.AddChild(slotB); this.AddChild(slotASelected); this.AddChild(slotBSelected); this.AddChild(hearts); slotASelected.isVisible = false; slotBSelected.isVisible = false; background.y = Futile.screen.halfHeight - background.height / 2f; slotB.y = background.y; slotA.y = background.y; slotB.x = -Futile.screen.halfWidth + slotB.width / 2f + 20; slotA.x = slotB.x + slotB.width / 2f + slotA.width / 2f + 3; slotASelected.SetPosition(slotA.GetPosition()); slotBSelected.SetPosition(slotB.GetPosition()); slotASelected.x += 1; slotBSelected.x += 1; hearts.y = background.y; hearts.x = Futile.screen.halfWidth - hearts.width / 2f - 20; }
public void Init(Player player, Vector2 startPos) { this.player = player; world.beastHolder.AddChild(holder = new FContainer()); gameObject.transform.position = new Vector3(startPos.x * FPhysics.POINTS_TO_METERS,startPos.y * FPhysics.POINTS_TO_METERS,0); gameObject.transform.parent = world.root.transform; bodyLink = gameObject.AddComponent<FPNodeLink>(); bodyLink.Init(holder, false); bodySprite = new FSprite("Evil-Eye_"+player.team.numString+"_01"); holder.AddChild(bodySprite); eyeSprite = new FSprite("Eye_" + player.numString); eyeSprite.scale = 0.33f; holder.AddChild(eyeSprite); //holder.alpha = 0.25f; goldSprite = new FSprite("Evil-Eye_crown_01"); holder.AddChild(goldSprite); goldSprite.isVisible = false; //goldSprite.shader = FShader.Additive; InitPhysics(); holder.ListenForUpdate(HandleUpdate); holder.ListenForLateUpdate(HandleLateUpdate); holder.ListenForFixedUpdate(HandleFixedUpdate); //AddTentacle(new Vector2(-20.0f, -20.0f), -90.0f); //AddTentacle(new Vector2(0.0f, -30.0f), 0.0f); //AddTentacle(new Vector2(20.0f, -20.0f), 90.0f); }
public HealthBar(float offsetX, float offsetY, float width, float height, float percentage) { this.offsetX = offsetX; this.offsetY = offsetY; _width = width; _height = height; _background = new FSprite("Futile_White"); _background.width = _width; _background.height = _height; _bar = new FSprite("Futile_White"); _bar.height = _height - DOUBLE_INSET; _bar.anchorX = 0.0f; _bar.x = -_width*0.5f + INSET; _background.color = new Color(0.15f,0.22f,0.35f); _percentage = Mathf.Clamp01(percentage); this.alpha = 0.0f; UpdatePercentage(); ListenForUpdate(HandleUpdate); }
public static FContainer getGameUIContainer(GamePage game) { if (GameUIContainer == null) { GameUIContainer = new FContainer(); // add background FSprite bg = new FSprite("UI_background.png"); bg.x = 0; bg.y = Futile.screen.halfHeight - (bg.height / 2); GameUIContainer.AddChildAtIndex(bg, 99); // add minimap GameUIContainer.AddChild(game._dungeon.minimap); // add gold count playerGold.text = "g: " + game.player.GoldCount; playerGold.x += -140; playerGold.y += Futile.screen.halfHeight - 20; GameUIContainer.AddChild(playerGold); // add sanity count playerSanity.text = game.player.HP.ToString(); playerSanity.x += 260; playerSanity.y += Futile.screen.halfHeight - 60; GameUIContainer.AddChild(playerSanity); return GameUIContainer; } else return GameUIContainer; }
public InGamePage() { FSprite bg = new FSprite("Atlases/bg"); bg.width = Futile.screen.width; bg.height = Futile.screen.height; AddChild(bg); hudStuff = new FLabel("Minecraftia", "Energy:"); hudShadow = new FLabel("Minecraftia", "Energy:"); hudStuff.scale = 0.7f; hudShadow.scale = 0.7f; hudShadow.color = Color.black; hudStuff.SetPosition(new Vector2(0 , (Futile.screen.height/2)*0.9f)); hudShadow.SetPosition(new Vector2( 1f, ((Futile.screen.height / 2) * 0.9f - 1))); gameArea = new FContainer(); enemies = new List<Entity>(); projectiles = new List<Entity>(); Enemyprojectiles = new List<Entity>(); entityContainer = new FContainer(); projectileContainer = new FContainer(); particleContainer = new FContainer(); gameArea.AddChild(particleContainer); particleContainer.AddChild(projectilesParticles = new FParticleSystem(300)); gameArea.AddChild(entityContainer); gameArea.AddChild(projectileContainer); AddChild(gameArea); InGamePage.CurrentInGamePage = this; ListenForUpdate(Update); jugador = new Player(); GenerateFoe(); AddChild(hudShadow); AddChild(hudStuff); }
public override void Start() { ShowTitle("ListDelayedActions\nClick to start the chain"); _sprites=new List<FSprite>(); //Build the grid FSprite sprite=new FSprite("Monkey_0"); float scale=0.25f; float width=sprite.textureRect.width*scale; float height=sprite.textureRect.height*scale; int rows=4; int columns=5; for(int i=0;i<columns;i++) { float x=-((float)(columns-1)*0.5f-(float)i)*width; for(int j=0;j<rows;j++) { float y=((float)(rows-1)*0.5f-(float)j)*height; sprite=new FSprite("Monkey_0"); sprite.scale=scale; sprite.x=x; sprite.y=y; _sprites.Add (sprite); AddChild(sprite); } } base.Start(); }
// Use this for initialization void Start() { FutileParams fparams = new FutileParams(true,true,false,false); fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, ""); fparams.origin = new Vector2(0.5f, 0.5f); Futile.instance.Init(fparams); Futile.atlasManager.LoadAtlas("Atlases/simple"); // Futile.atlasManager.LoadFont("Arial", "Arial.png", "Atlases/Arial"); gcmap = new GCMap(); gcmap.Init(); player = new FSprite("green.png"); enemy = new FSprite("dark_grey.png"); Futile.stage.AddChild(gcmap); Futile.stage.AddChild(player); Futile.stage.AddChild (enemy); gcmap.x = -240; gcmap.y = 160; player.x = 0; player.y = 0; enemy.x = 6 * 32; enemy.y = -3 * 32; }
public override void Start() { ShowTitle("GoKit Shake and Oscillate"); _sprites=new List<FSprite>(); _spriteAnims=new List<GoTween>(); //Build the grid FSprite sprite=new FSprite("Monkey_0"); float scale=0.25f; float width=sprite.textureRect.width*scale; float height=sprite.textureRect.height*scale; int rows=4; int columns=5; for(int i=0;i<columns;i++) { float x=-((float)(columns-1)*0.5f-(float)i)*width; for(int j=0;j<rows;j++) { float y=((float)(rows-1)*0.5f-(float)j)*height; sprite=new FSprite("Monkey_0"); sprite.scale=scale; sprite.x=x; sprite.y=y; _sprites.Add(sprite); AddChild(sprite); } } base.Start(); TempMessage("Click to start",2f); }
public Wolf(WolfActivePlayer player, EntityArea entityArea) : base(entityArea) { this.player = player; offsetY = 12f; body = new FContainer(); bodySprite = new FSprite(WolfAnimation.Idle.frames[0]); body.AddChild(bodySprite); bodySprite.color = player.player.color.color + new Color(0.5f,0.5f,0.5f,0.0f); bodySprite.y = offsetY; body.scaleX = player.isFacingLeft ? 1f : -1f; // colorSprite = new FSprite("Arena/Wolf_Idle1_color"); // colorSprite.color = player.player.color.color; // body.AddChild(colorSprite); // shadowSprite = new FSprite("Arena/VillShadow"); shadowSprite.alpha = 0.2f; shadowSprite.scaleX = 1.9f; shadowSprite.scaleY = 1.0f; }
public StateTitle(StateGame game) : base(TITLE) { //Initialize m_Game = game; m_Time = BLINK_DURATION * 2; m_StartTime = START_DURATION * 2; //Create background FSprite Background = new FSprite("rect") { x = Futile.screen.halfWidth, y = Futile.screen.halfHeight, width = Futile.screen.width, height = Futile.screen.height, color = new Color(0, 0, 0, 0.5f) }; AddChild(Background); //Create stuff m_Title = new FSprite("logo") { x = Futile.screen.halfWidth, y = Futile.screen.height * 0.6f }; m_Instruction1 = new FLabel("font", "Tap screen to play") { x = Futile.screen.halfWidth, y = Futile.screen.height * 0.2f }; AddChild(m_Instruction1); AddChild(m_Title); //Credit /*FLabel Credit1 = new FLabel("visitor-small", "A game by Karunia Ramadhan, Namira Chaldea, and Raka Mahesa") { x = Futile.screen.halfWidth }; Credit1.y = 4 + (Credit1.textRect.height * 0.5f); AddChild(Credit1);*/ //Play music FSoundManager.PlayMusic("bgm", 1f); }
private void CreateBananaExplodeEffect(BBanana banana) { //we can't just get its x and y, because they might be transformed somehow Vector2 bananaPos = _effectHolder.OtherToLocal(banana, Vector2.zero); FSprite explodeSprite = new FSprite("Banana"); _effectHolder.AddChild(explodeSprite); //设置Shader、XY、旋转 explodeSprite.shader = FShader.Additive; explodeSprite.x = bananaPos.x; explodeSprite.y = bananaPos.y; explodeSprite.rotation = banana.rotation; Go.to(explodeSprite, 0.3f, new TweenConfig().floatProp("scale", 1.3f).floatProp("alpha", 0.0f).onComplete(HandleExplodeSpriteComplete)); }
public void Init(Vector2 startPos, FContainer container) { gameObject.transform.position = new Vector3(startPos.x * FPhysics.POINTS_TO_METERS, startPos.y * FPhysics.POINTS_TO_METERS, 0); sprite = new FSprite(Futile.whiteElement); sprite.width = 100; sprite.height = 1000; sprite.SetPosition(startPos); container.AddChild(holder = new FContainer()); holder.AddChild(sprite); InitPhysics(); holder.ListenForUpdate(HandleUpdate); }
private TemporalSprite(string sprite, int lifespan, FContainer parent, float xOff, float yOff, float scaleX, float scaleY, bool beam, Vector2 velocity) : base() { this.sprite = new FSprite(sprite); this.AddChild(this.sprite); this.lifespan = lifespan; this.fullLife = lifespan; this.parent = parent; this.beam = beam; this.x += xOff; this.y += yOff; this.scaleX = scaleX; this.scaleY = scaleY; this.velocity = new Vector2(); }
public void SetupDashes(List <DashData> dashDatas) { for (int d = 0; d < dashDatas.Count; d++) { FSprite dash = new FSprite("Box"); dash.SetAnchor(0, 0); dash.width = dashWidth; dash.height = dashHeight; dash.x = dashOffset.x + d * (dashWidth + dashSpacing); dash.y = dashOffset.y; dash.color = dashDatas[d].color; dashes.Add(dash); dashContainer.AddChild(dash); } }
public void SetupHeartShower() { heartShowerHearts = new List <FSprite>(); for (int i = 0; i < 200; i++) { FSprite heart = new FSprite("heart.psd"); heart.color = new Color(0.75f, Random.Range(0, 0.3f), Random.Range(0, 0.3f), 1.0f); heart.isVisible = false; heart.alpha = Random.Range(0.6f, 1.0f); heart.rotation = Random.Range(0, 359); heart.scale = Random.Range(0.1f, 1.0f); heartShowerHearts.Add(heart); everythingContainer.AddChild(heart); } }
public Agent(int player) : base("Agent_Ship.png") { playerLabel = new FLabel("FranchiseFont_Scale1", player.ToString()); playerLabel.scale = 0.3f; InGamePage.instance.AddChild(playerLabel); size = 20f; scaleX = size / 100; scaleY = size / 100; this.player = player; primarySound = ""; secondarySound = ""; bulletid = 13; //secondaryid = 14; primaryCost = 5.0f; secondaryCost = 25.0f; BindKeys(); maxSpeedBase = 175.0f; maxSpeed = maxSpeedBase; thrustBase = 200.0f; thrust = thrustBase; maxHealth = 130; maxShields = 30; turnRateBase = 5.1f; turnRate = turnRateBase; health = maxHealth; healthBar = new FSprite("Health_Bar_Red.png"); healthBar.scaleX = (health / (maxHealth * 3f)); healthBar.scaleY = 0.2f; shields = maxShields; shieldBar = new FSprite("Health_Bar_Green.png"); shieldBar.scaleX = (shields / (maxShields * 3f)); shieldBar.scaleY = 0.2f; InGamePage.instance.AddChild(shieldBar); mass = 3.0f; InGamePage.instance.AddChild(healthBar); firerate = 1; secondaryfirerate = 1; shipType = "Agent"; maxEnergy = 100.0f; energy = maxEnergy; energyBar = new FSprite("Health_Bar_1.png"); energyBar.scaleX = (energy / (maxEnergy * 3f)); energyBar.scaleY = 0.2f; InGamePage.instance.AddChild(energyBar); invulnerable = false; //Other Ship Values }
public ImUILayer() { /*zoomInButton = new FButton("whiteSquare.png", "whiteSquare.png", null); * zoomOutButton = new FButton("whiteSquare.png", "whiteSquare.png", null); * zoomInButton.data = UIButtonType.ZoomIn; * zoomOutButton.data = UIButtonType.ZoomOut; * zoomInButton.sprite.color = Color.blue; * zoomOutButton.sprite.color = Color.red; * zoomInButton.sprite.width = zoomOutButton.sprite.width = 40f; * zoomInButton.sprite.height = zoomOutButton.sprite.height = 20f; * zoomInButton.anchorX = zoomOutButton.anchorX = 1f; * zoomInButton.anchorY = zoomOutButton.anchorY = 1f; * float padding = 5f; * zoomInButton.x = zoomOutButton.x = Futile.screen.width - padding; * zoomInButton.y = Futile.screen.height - padding; * zoomOutButton.y = zoomInButton.y - zoomInButton.sprite.height - padding; * AddChild(zoomInButton); * AddChild(zoomOutButton);*/ float margin = 10f; float paddingBetweenShit = 10f; dollarsLabel = new FLabel("TwCen", string.Format("$" + ImPlayerStats.dollars)); dollarsLabel.anchorX = 0; dollarsLabel.anchorY = 1; dollarsLabel.x = margin; dollarsLabel.y = Futile.screen.height - margin; dollarsLabel.scale = 0.25f; AddChild(dollarsLabel); pauseButton = new FSprite("transportPause.psd"); playButton = new FSprite("transportPlayPressed.psd"); pauseButton.color = playButton.color = new Color(0.8f, 0.8f, 1.0f, 1.0f); pauseButton.anchorX = playButton.anchorX = 0; pauseButton.anchorY = playButton.anchorY = 1; pauseButton.x = margin; playButton.x = pauseButton.x + pauseButton.width; playButton.y = pauseButton.y = dollarsLabel.y - dollarsLabel.textRect.height * dollarsLabel.scaleY - paddingBetweenShit; AddChild(pauseButton); AddChild(playButton); ImPlayerStats.SignalDollarsChanged += HandleDollarsChanged; }
//TBorderLayer border; public TWalkingCharacter(string headImage) { FAtlasManager am = Futile.atlasManager; frameElements = new FAtlasElement[8]; crouchFrameElements = new FAtlasElement[8]; frameElements[0] = am.GetElementWithName("walkAnim/walk0.png"); frameElements[1] = am.GetElementWithName("walkAnim/walk1.png"); frameElements[2] = am.GetElementWithName("walkAnim/walk2.png"); frameElements[3] = am.GetElementWithName("walkAnim/walk3.png"); frameElements[4] = am.GetElementWithName("walkAnim/walk4.png"); frameElements[5] = am.GetElementWithName("walkAnim/walk1.png"); frameElements[6] = am.GetElementWithName("walkAnim/walk2.png"); frameElements[7] = am.GetElementWithName("walkAnim/walk3.png"); crouchFrameElements[0] = am.GetElementWithName("squashedWalkAnim/squashedWalk0.png"); crouchFrameElements[1] = am.GetElementWithName("squashedWalkAnim/squashedWalk1.png"); crouchFrameElements[2] = am.GetElementWithName("squashedWalkAnim/squashedWalk2.png"); crouchFrameElements[3] = am.GetElementWithName("squashedWalkAnim/squashedWalk3.png"); crouchFrameElements[4] = am.GetElementWithName("squashedWalkAnim/squashedWalk4.png"); crouchFrameElements[5] = am.GetElementWithName("squashedWalkAnim/squashedWalk1.png"); crouchFrameElements[6] = am.GetElementWithName("squashedWalkAnim/squashedWalk2.png"); crouchFrameElements[7] = am.GetElementWithName("squashedWalkAnim/squashedWalk3.png"); bodySprite = new FSprite("walkAnim/walk0.png"); bodySprite.scale = 0.5f; bodySprite.anchorY = 0; bodySprite.y = -200f; AddChild(bodySprite); headSprite = new FSprite(headImage); headSprite.y = 25f; headSprite.x -= 5f; headSprite.scale = 0.5f; headSprite.anchorY = 0; headSprite.rotation = -3f; AddChild(headSprite); Tween rotateOut = new Tween(headSprite, 0.3f, new TweenConfig().floatProp("rotation", 3f)); Tween rotateIn = new Tween(headSprite, 0.3f, new TweenConfig().floatProp("rotation", -3f)); chain = new TweenChain(); chain.setIterations(-1); chain.append(rotateOut).append(rotateIn); Go.addTween(chain); }
public override void Init() { SetStage(new FStage("MAIN")); SetPixelOffset(0, 0, Futile.screen.width, Futile.screen.height); FSprite tIcon = new FSprite("Brazil"); AddSprite(tIcon); tIcon.width = 128.0f * Futile.displayScale; tIcon.height = 128.0f * Futile.displayScale; tIcon.SetPosition(64.0f * Futile.displayScale, 64.0f * Futile.displayScale); FSprite tIcon2 = new FSprite("England"); AddSprite(tIcon2); tIcon2.width = 128.0f * Futile.displayScale; tIcon2.height = 128.0f * Futile.displayScale; tIcon2.SetPosition(-64.0f * Futile.displayScale, -64.0f * Futile.displayScale); }
public MainMenu() : base() { _optionsMenu = new OptionsMenu(this); _background = new FSprite("mainbackground"); _background.scale = 1.2f * screenHeight / 270f; container.AddChild(_background); _titleSprites = new FSprite[3]; _titleSprites[0] = new FSprite("titlei"); _titleSprites[1] = new FSprite("titles"); _titleSprites[2] = new FSprite("titleo"); for (int i = _titleSprites.Length - 1; !(i < 0); i--) { _titleSprites[i].x = screenWidth * 0.5f - ((3 - i) * 40f); _titleSprites[i].y = -screenHeight; _titleSprites[i].scale = 2f; container.AddChild(_titleSprites[i]); } _buttons = new GeneralButton[3]; _buttons[0] = new GeneralButton(this, "Start", OnWorldSelect); _buttons[1] = new GeneralButton(this, "Options", OpenOptions); _buttons[2] = new GeneralButton(this, "Quit", OnApplicationQuit); _buttons[0].position = new Vector2(0f, 88f - screenHeight * 0.5f); _buttons[0].size = new Vector2(48f, 48f); _buttons[1].position = new Vector2(0f, 48f - screenHeight * 0.5f); _buttons[1].size = new Vector2(48f, 16f); _buttons[2].position = new Vector2(0f, 24f - screenHeight * 0.5f); _buttons[2].size = new Vector2(48f, 16f); for (int index = 0; index < _buttons.Length; index++) { AddElement(_buttons[index]); } _worldSelect = new WorldSelect(this); _visitDevLog = new GeneralButton(this, "Wanna See Devlog?", OnVisitDevLog); _visitDevLog.position = new Vector2(0f, screenHeight * -0.5f + 24f); _visitDevLog.size = new Vector2(96f, 16f); AddElement(_visitDevLog); }
public BossInterface(EntityCreature owner) : base() { _owner = owner; _bar = new FSprite("uipixel"); _bar.scaleY = 8f; _barCase = new FSprite("bosshealth"); _barContainer = new FContainer(); _barContainer.SetPosition(0f, MenuFlow.screenHeight * 0.5f - 16f); _barContainer.AddChild(_bar); _barContainer.AddChild(_barCase); container.AddChild(_barContainer); }
public Clock() : base("clock", true, 0, 1.0f) { label = new FLabel("Large", "Time Left"); timeLabel = new FLabel("Small", "10"); timeLabel.color = Color.black; x = Futile.screen.halfWidth - width * tickScale / 2 - clockMargin; y = Futile.screen.halfHeight - height * tickScale / 2 - clockMargin; timeLabel.SetPosition(this.GetPosition()); this.scale = normalScale; clockBackground = new FSprite("clock"); clockBackground.SetPosition(GetPosition()); label.x = x; label.y = y + height / 3 * tickScale / 2; labelShadow = new FLabel("Large", "Time Left"); labelShadow.color = new Color(0, 0, 0, .5f); }
public void AddLogoListToScreen() { List <LogoPart> tParts = LogoPart.GetPartList(LogoPart.ePartFilter); int iCount = Mathf.Min(tParts.Count, iMaxLogos + iPage * iMaxLogos); for (int iPart = iPage * iMaxLogos; iPart < iCount; ++iPart) { Rect tPartRect = GetLayerPartRect(iPart - iPage * iMaxLogos); FSprite tSprite = new FSprite(tParts[iPart].sImageName); tScreen.AddSprite(tSprite); tSprite.width = tPartRect.width; tSprite.height = tPartRect.height; tSprite.SetPosition(tPartRect.x, tPartRect.y); tSprite.color = iCurrentSelection == iPart ? Color.cyan : Color.white; } }
public Vignette(ExposureController controller) { this.controller = controller; this.camera = this.controller.cam; this.vignette = new FSprite("Futile_White", true); this.vignette.alpha = 0f; this.vignette.color = Color.white; this.vignette.SetAnchor(0.5f, 0.5f); this.vignette.x = this.camera.game.rainWorld.screenSize.x / 2f; this.vignette.y = this.camera.game.rainWorld.screenSize.y / 2f; this.vignette.scaleX = this.camera.game.rainWorld.screenSize.x; this.vignette.scaleY = this.camera.game.rainWorld.screenSize.y; this.vignette.shader = this.camera.game.rainWorld.Shaders["EdgeFade"]; this.camera.AddSingleCameraDrawable(this); this.camera.ReturnFContainer("HUD").AddChild(this.vignette); Debug.Log("VIGNETTE CREATED"); }
public HUDLayer() : base() { FSprite banner = new FSprite("whiteSquare.png"); banner.width = Futile.screen.width; banner.height = 30; banner.x = Futile.screen.halfWidth; banner.anchorY = 0; banner.y = Futile.screen.height - 30; banner.color = new Color(0.25f, 0.25f, 0.25f, 1.0f); AddChild(banner); scoreLabel.x = Futile.screen.halfWidth; scoreLabel.y = Futile.screen.height - 15; scoreLabel.scale = 0.3f; AddChild(scoreLabel); }
/// <summary> /// Allow users to choose relative path. /// </summary> /// <param name="pos">LeftBottom position. This is a circular button with radius of 30 pxl.</param> /// <param name="key">Unique <see cref="UIconfig.key"/></param> /// <param name="defaultPath"></param> /// <param name="extension">Requested extension ('dir' for directory, default is *)</param> /// <exception cref="ElementFormatException">Thrown when defaultPath is Invalid</exception> public OpPathSelector(Vector2 pos, string key, string defaultPath = "", string extension = "*") : base(pos, 30f, key, defaultPath) { this.extension = extension; if (!string.IsNullOrEmpty(defaultPath)) { try { Path.GetFullPath(this.value); } catch (Exception e) { throw new ElementFormatException($"OpPathSelector (key: {key} has Invalid defaultPath: {defaultPath}", e); } } fixedRad = 30f; if (_init) { return; } color = Menu.Menu.MenuRGB(Menu.Menu.MenuColors.MediumGrey); circles = new FSprite[5]; circles[0] = new FSprite("Futile_White") { shader = menu.manager.rainWorld.Shaders["VectorCircleFadable"] }; circles[1] = new FSprite("Futile_White") { shader = menu.manager.rainWorld.Shaders["VectorCircle"] }; circles[2] = new FSprite("Futile_White") { shader = menu.manager.rainWorld.Shaders["HoldButtonCircle"] }; circles[3] = new FSprite("Futile_White") { shader = menu.manager.rainWorld.Shaders["VectorCircle"] }; circles[4] = new FSprite("Futile_White") { shader = menu.manager.rainWorld.Shaders["VectorCircleFadable"] }; for (int i = 0; i < circles.Length; i++) { myContainer.AddChild(circles[i]); circles[i].SetPosition(55f, 55f); } throw new NotImplementedException("OpPathSelector might come to you, in future! If you're seeing this error as an user, download the latest ConfigMachine."); }
public MoveHandle(string name) { handle = new FSprite("buttonCircleA") { anchorX = 0.5f, anchorY = 0.5f, color = Color.red }; this.name = new FLabel("font", name) { anchorX = 0f, anchorY = 0.5f }; nameShadow = new FLabel("font", name) { anchorX = 0f, anchorY = 0.5f, color = Color.black }; Futile.stage.AddChild(handle); Futile.stage.AddChild(nameShadow); Futile.stage.AddChild(this.name); }
private InputButton(InputGraphic parent, Vector2 pos, Func <Inputs, bool> inputGetter) { this.parent = parent; _back = new FSprite("pixel") { anchorX = 0f, anchorY = 0f, scale = Size, color = backColor }; _front = new FSprite("pixel") { anchorX = 0f, anchorY = 0f, scale = Size - 2f }; _rtIndicator = new FSprite("deerEyeB") { anchorX = 0f, anchorY = 0f }; _inputGetter = inputGetter; relPos = pos; }
override public void Start() { // Access immunity menu immunityMenu = GameObject.Find("Futile").GetComponent <ImmunityMenu>(); // Sound FSoundManager.StopMusic(); FSoundManager.UnloadAllSoundsAndMusic(); FSoundManager.PlayMusic("background_music"); FSoundManager.PreloadSound("button_click"); // GUI objects background_ = new FSprite("start screen final"); play_button = new FButton("Play", "PlayPressed"); how_to_play_button = new FButton("how_to_play", "how_to_play_pressed"); credits_button = new FButton("Credits", "CreditsPressed"); // Add objects to stage AddChild(background_); AddChild(play_button); AddChild(how_to_play_button); AddChild(credits_button); // Scale and set position background_.scale = 0.0f; play_button.scale = .6f; play_button.x = Futile.screen.halfWidth * .3f; play_button.y = Futile.screen.halfHeight * .1f; how_to_play_button.x = Futile.screen.halfWidth * .45f; how_to_play_button.y = Futile.screen.halfHeight * -.3f; credits_button.scale = .6f; credits_button.x = Futile.screen.halfWidth * .35f; credits_button.y = Futile.screen.halfHeight * -.7f; // Set button delegates play_button.SignalRelease += HandlePlayButton; how_to_play_button.SignalRelease += HandleHowToPlayButton; credits_button.SignalRelease += HandleCreditsButton; Go.to(background_, 0.5f, new TweenConfig().setDelay(0.1f).floatProp("scale", 1.0f).setEaseType(EaseType.BackOut)); }
public static Rect GetContentRect(this FContainer container) { int childCount = container.GetChildCount(); if (childCount == 0) { return(new Rect(0, 0, 0, 0)); } float minX = 1000000f; float maxX = -1000000f; float minY = 1000000f; float maxY = -1000000f; for (int i = 0; i < childCount; i++) { FSprite sprite = container.GetChildAt(i) as FSprite; float spriteMinX = sprite.textureRect.xMin + (sprite.textureRect.width - (sprite.scaleX * sprite.textureRect.width)) / 2; float spriteMaxX = sprite.textureRect.xMax - (sprite.textureRect.width - (sprite.scaleX * sprite.textureRect.width)) / 2; float spriteMinY = sprite.textureRect.yMin + (sprite.textureRect.height - (sprite.scaleX * sprite.textureRect.width)) / 2; float spriteMaxY = sprite.textureRect.yMax - (sprite.textureRect.height - (sprite.scaleX * sprite.textureRect.width)) / 2; minX = Mathf.Min(minX, spriteMinX); maxX = Mathf.Max(maxX, spriteMaxX); minY = Mathf.Min(minY, spriteMinY); maxY = Mathf.Max(maxY, spriteMaxY); } float width = maxX - minX; float height = maxY - minY; minX = minX + (width - (container.scaleX * width) / 2); maxX = maxX + (width - (container.scaleX * width) / 2); minY = minY + (height - (container.scaleY * height) / 2); maxY = maxY + (height - (container.scaleY * height) / 2); width = container.scaleX * width; height = container.scaleY * height; Rect rect = new Rect(minX, maxY, width, height); return(rect); }
public FDebugFrameRateGraph() : base() { _texWidth = BASE_TEX_WIDTH; _texHeight = BASE_TEX_HEIGHT; _numPixels = _texWidth * _texHeight; _newFramePixels = new Color[_texHeight]; _graphTex = new Texture2D(_texWidth, _texHeight, TextureFormat.ARGB32, false); _graphTex.filterMode = FilterMode.Point; // Initialize the graph Color[] blank = new Color[_numPixels]; for (int i = 0; i < _numPixels; i++) { blank[i] = _blank; } _graphTex.SetPixels(blank); // Draw lines for the target frame rate _targetRow = Mathf.FloorToInt(IDEAL_FRAME_TIME / (MAX_FRAME_TIME / _texHeight)); _doubleTargetRow = Mathf.FloorToInt(2.0f * IDEAL_FRAME_TIME / (MAX_FRAME_TIME / _texHeight)); Color[] targetColor = new Color[_texWidth]; Color[] doubleTargetColor = new Color[_texWidth]; Color[] maxTargetColor = new Color[_texWidth]; for (int i = 0; i < _texWidth; i++) { targetColor[i] = Color.black; doubleTargetColor[i] = Color.black; maxTargetColor[i] = Color.black; } _graphTex.SetPixels(0, _targetRow, _texWidth, 1, targetColor); _graphTex.SetPixels(0, _doubleTargetRow, _texWidth, 1, doubleTargetColor); _graphTex.SetPixels(0, _texHeight - 1, _texWidth, 1, maxTargetColor); _graphTex.Apply(); Futile.atlasManager.LoadAtlasFromTexture("debugFrameGraph", _graphTex); _graphSprite = new FSprite("debugFrameGraph"); _graphSprite.SetAnchor(0.0f, 0.0f); _graphSprite.scale = Futile.resourceScale; AddChild(_graphSprite); ListenForUpdate(HandleUpdate); }
public Enemy(string name, List <Step> steps) : base(name, steps) { sonar = new FSprite(name + "_sonar"); AddChild(sonar); switch (name) { case "boat1": sonar.y = -165f; sonar.x = -14f; sonar_vert_1 = new Vector2(sonar.x, sonar.y + sonar.height / 2); sonar_vert_2 = new Vector2(sonar.x - sonar.width / 2, sonar.y - sonar.height / 2); sonar_vert_3 = new Vector2(sonar.x + sonar.width / 2, sonar.y - sonar.height / 2); break; case "boat2": sonar.y = -91f; sonar.x = -7f; sonar_vert_1 = new Vector2(sonar.x, sonar.y + sonar.height / 2); sonar_vert_2 = new Vector2(sonar.x - sonar.width / 2, sonar.y - sonar.height / 2); sonar_vert_3 = new Vector2(sonar.x + sonar.width / 2, sonar.y - sonar.height / 2); break; case "sub1": sonar.y = 4f; sonar.x = -175f; sonar_vert_1 = new Vector2(sonar.x + sonar.width / 2, sonar.y); sonar_vert_2 = new Vector2(sonar.x - sonar.width / 2, sonar.y - sonar.height / 2); sonar_vert_3 = new Vector2(sonar.x - sonar.width / 2, sonar.y + sonar.height / 2); break; case "sub2": sonar.y = 4f; sonar.x = -105f; sonar_vert_1 = new Vector2(sonar.x + sonar.width / 2, sonar.y); sonar_vert_2 = new Vector2(sonar.x - sonar.width / 2, sonar.y - sonar.height / 2); sonar_vert_3 = new Vector2(sonar.x - sonar.width / 2, sonar.y + sonar.height / 2); break; default: break; } }
public virtual void AddSprite(FSprite tSprite) { if (tSprite != null) { if (m_tSprites == null) { m_tSprites = new List <FNode>(); } m_tSprites.Add(tSprite); if (m_tStage != null) { m_tStage.AddChild(tSprite); } else { Futile.stage.AddChild(tSprite); } } }
public void OnItemChanged() { bool visible = false; if (!_itemContainer.blank) { if (_itemContainer.itemStack.item.element != null) { visible = true; } } if (visible) { if (_itemSprite == null) { _itemSprite = new FSprite(itemContainer.itemStack.item.element); container.AddChild(_itemSprite); container.AddChild(_itemAmount); } else { _itemSprite.element = itemContainer.itemStack.item.element; } _itemAmount.text = itemContainer.itemStack.stackSize.ToString(); } if (_itemSprite != null) { _itemSprite.isVisible = visible; bool isItemBlock = false; if (!itemContainer.blank) { isItemBlock = itemContainer.itemStack.item is ItemBlock; } _itemSprite.scale = isItemBlock ? 0.75f : 1f; _itemAmount.isVisible = visible && itemContainer.itemStack.stackSize > 1; } }
override public void SecondaryFire() { if (energy > secondaryCost + 10f) { if (damageReduction == 0) { if (DogfighterMain.instance.soundOn) { FSoundManager.PlaySound(secondarySound, 3f); } damageReduction = 100f; altSprite = new FSprite("Ghost_Ship_Stealth.png"); altSprite.scaleX = size / 100; altSprite.scaleY = size / 100; InGamePage.instance.RemoveChild(this); InGamePage.instance.RemoveChild(this.healthBar); InGamePage.instance.RemoveChild(this.energyBar); InGamePage.instance.RemoveChild(this.shieldBar); InGamePage.instance.AddChild(altSprite); altSprite.x = x; altSprite.y = y; altSprite.rotation = rotation; energy -= 5f; } else { energy -= secondaryCost; altSprite.x = x; altSprite.y = y; altSprite.rotation = rotation; } } else { damageReduction = 0f; InGamePage.instance.AddChild(this); InGamePage.instance.AddChild(this.healthBar); InGamePage.instance.AddChild(this.energyBar); InGamePage.instance.AddChild(this.shieldBar); altSprite.RemoveFromContainer(); } }
public void ctor(MapPage myMapPage, AbstractCreature crit) { this.myMapPage = myMapPage; this.crit = crit; label = new FLabel("font", CritString(crit)); label2 = new FLabel("font", CritString(crit)); label2.color = new Color(1f - label.color.r, 1f - label.color.g, 1f - label.color.b); sprite = new FSprite("pixel", true); sprite.anchorY = 0f; if (crit.abstractAI != null) { sprite2 = new FSprite("pixel", true); sprite2.alpha = 0.25f; sprite2.anchorY = 0f; Futile.stage.AddChild(sprite2); } Futile.stage.AddChild(sprite); Futile.stage.AddChild(label); }
public VillTorch() { frameTime = RXRandom.Range(0, 100); frames = new FAtlasElement[] { Futile.atlasManager.GetElementWithName("Arena/Torch_1"), Futile.atlasManager.GetElementWithName("Arena/Torch_2"), Futile.atlasManager.GetElementWithName("Arena/Torch_3"), Futile.atlasManager.GetElementWithName("Arena/Torch_4"), Futile.atlasManager.GetElementWithName("Arena/Torch_5"), }; frameToShow = RXRandom.Range(0, frames.Length); sprite = new FSprite(frames[frameToShow]); AddChild(sprite); ListenForUpdate(Update); }
public static void init(MonoBehaviour handler, string backdropSprite = "") { coroutineHandler = handler; backdrop = null; if (backdropSprite != "") { backdrop = new FSprite(backdropSprite); backdrop.scaleX = Futile.screen.width / backdrop.width; backdrop.scaleY = Futile.screen.height / backdrop.height; // NOTE: The following two lines recolor the backdrop sprite backdrop.shader = FShader.SolidColored; backdrop.color = RXUtils.GetColorFromHex("555555"); } screenLayer = new FContainer(); Futile.stage.AddChild(screenLayer); }
/// <summary> /// Circular Hold Button which can also be used as ProgressButton /// </summary> /// <param name="pos">BottomLeft <see cref="UIelement.pos"/>; <see cref="UIelement.fixedRad"/> is 55f (110f in diameter)</param> /// <param name="signal"><see cref="UItrigger.signal"/></param> /// <param name="fillTime">How long do you need to hold to call Signal (set to 0f for instant)</param> /// <param name="displayText">Text to be displayed (overriden when it's ProgressButton mode)</param> public OpHoldButton(Vector2 pos, string signal, string displayText, float fillTime = 80f) : base(pos, 55f, signal) { this.fillTime = Mathf.Max(0f, fillTime); fixedRad = 55f; _text = displayText; color = Menu.Menu.MenuRGB(Menu.Menu.MenuColors.MediumGrey); if (!_init) { return; } circles = new FSprite[5]; circles[0] = new FSprite("Futile_White") { shader = menu.manager.rainWorld.Shaders["VectorCircleFadable"] }; circles[1] = new FSprite("Futile_White") { shader = menu.manager.rainWorld.Shaders["VectorCircle"] }; circles[2] = new FSprite("Futile_White") { shader = menu.manager.rainWorld.Shaders["HoldButtonCircle"] }; circles[3] = new FSprite("Futile_White") { shader = menu.manager.rainWorld.Shaders["VectorCircle"] }; circles[4] = new FSprite("Futile_White") { shader = menu.manager.rainWorld.Shaders["VectorCircleFadable"] }; for (int i = 0; i < circles.Length; i++) { myContainer.AddChild(circles[i]); circles[i].SetPosition(55f, 55f); } label = new FLabel(LabelTest.GetFont(false), text) { alignment = FLabelAlignment.Center }; label.SetPosition(new Vector2(55.01f, 55.01f)); myContainer.AddChild(label); }
public FButton(string upElementName, string downElementName, string overElementName, string clickSoundName) { _upElement = Futile.atlasManager.GetElementWithName(upElementName); _downElement = Futile.atlasManager.GetElementWithName(downElementName); if (overElementName != null) { _overElement = Futile.atlasManager.GetElementWithName(overElementName); _supportsOver = true; } _sprite = new FSprite(_upElement.name); _sprite.anchorX = _anchorX; _sprite.anchorY = _anchorY; AddChild(_sprite); _hitRect = _sprite.textureRect; _clickSoundName = clickSoundName; }