Пример #1
0
    override public void Start()
    {
        _background = new FSprite("JungleBlurryBG");
        AddChild(_background);

        //the banana container will make it easy to keep the bananas at the right depth
        _foodContainer = new FContainer();
        AddChild(_foodContainer);
        List <string> foodList = new List <string>();

        foodList.Add("Monkey_0");
        for (int i = 0; i < 8; ++i)
        {
            foodList.Add("Banana");
        }
        LayOutFood(foodList);
        //Clear out selected list
        BMain.instance.selected_foods.Clear();

        _closeButton = new FButton("CloseButton_normal", "CloseButton_down", "CloseButton_over", "ClickSound");
        AddChild(_closeButton);
        _closeButton.SignalRelease += HandleCloseButtonRelease;

        _scoreLabel         = new FLabel("Franchise", "0 Bananas");
        _scoreLabel.anchorX = 0.0f;
        _scoreLabel.anchorY = 1.0f;
        _scoreLabel.scale   = 0.75f;
        _scoreLabel.color   = new Color(1.0f, 0.90f, 0.0f);

        _timeLabel         = new FLabel("Franchise", ((int)_secondsLeft) + " Seconds Left");
        _timeLabel.anchorX = 1.0f;
        _timeLabel.anchorY = 1.0f;
        _timeLabel.scale   = 0.75f;
        _timeLabel.color   = new Color(1.0f, 1.0f, 1.0f);

        AddChild(_scoreLabel);
        AddChild(_timeLabel);

        _effectHolder = new FContainer();
        AddChild(_effectHolder);

        _scoreLabel.alpha = 0.0f;
        Go.to(_scoreLabel, 0.5f, new TweenConfig().
              setDelay(0.0f).
              floatProp("alpha", 1.0f));

        _timeLabel.alpha = 0.0f;
        Go.to(_timeLabel, 0.5f, new TweenConfig().
              setDelay(0.0f).
              floatProp("alpha", 1.0f).
              setEaseType(EaseType.BackOut));

        _closeButton.scale = 0.0f;
        Go.to(_closeButton, 0.5f, new TweenConfig().
              setDelay(0.0f).
              floatProp("scale", 1.0f).
              setEaseType(EaseType.BackOut));

        HandleResize(true);         //force resize to position everything at the start
    }
Пример #2
0
    public SlotList(float width, float height)
    {
        _width = width;
        _height = height;

        touchableRect = new Rect(-_width/2,-10000,_width-Config.SLOT_HEIGHT*2-Config.PADDING_XS*2,20000);//infinite height because thaat's how i doooo

        _scroller = new RXScroller(0,_minScrollY,_maxScrollY);

        _touchSlot = Futile.touchManager.GetTouchSlot(0);

        AddChild(slotContainer = new FContainer());

        List<Player> players = SKDataManager.GetPlayers();

        for(int p = 0; p<players.Count; p++)
        {
            AddSlotForPlayer(players[p], false);
        }

        Reorder(false,false);

        ListenForUpdate(HandleUpdate);

        _isInitializing = false;
    }
Пример #3
0
    public Keeper()
    {
        instance = this;

        SKDataManager.LoadData();

        CellManager.Recalculate();

        AddChild(mainContainer = new FContainer());

        SetupMegaBoxes();

        mainContainer.AddChild(slotList = new SlotList(Config.LIST_WIDTH, Config.HEIGHT));

        AddChild(effectContainer = new FContainer());

        slotList.SignalPlayerChange += HandlePlayerChange;

        HandlePlayerChange();

        Futile.screen.SignalResize += HandleSignalResize;
        Futile.instance.SignalLateUpdate += HandleLateUpdate;

        FSoundManager.PlaySound("UI/Start");
    }
Пример #4
0
    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 static void Create(FNode content, int lifespan, FContainer parent, float xOff, float yOff,
                              float scaleX = 1f, float scaleY = 1f, bool beam = false, float xVelocity = 0f, float yVelocity = 0f)
    {
        TemporalSprite temp = new TemporalSprite(content, lifespan, parent, xOff, yOff, scaleX, scaleY, beam, new Vector2(xVelocity, yVelocity));

        ScreenManager.StartCoroutine(temp.LiveOutAndDie());
    }
Пример #6
0
    virtual protected FNode createObjectLayer(XMLNode node)
    {
        // add objects to FContainers
        FContainer objectGroup = new FContainer();

        foreach (XMLNode fObject in node.children)
        {
            if (fObject.tagName == "object")
            {
                if (fObject.attributes.ContainsKey("gid"))
                {
                    // create FSprite (override that function for specific class changes)
                    objectGroup.AddChild(this.createTileObject(fObject));
                }
                else
                {
                    FNode newObject = this.createObject(fObject);
                    if (newObject != null)
                    {
                        objectGroup.AddChild(newObject);
                    }
                }
            }
        }

        // remember name
        _layerNames.Add(node.attributes["name"]);

        // add to self
        return(objectGroup);
    }
Пример #7
0
    public ProjectsProcess()
    {
        updateList   = new List <UpdatableObject>();
        spriteGroups = new List <SpriteGroup>();
        Futile.atlasManager.LoadAtlas("Atlases/projectsAtlas");

        // Find all projects
        projectDirectories = new List <string>();
        string rootDirectory = Application.dataPath + "/../ActiveProject";

        string[] subDirectories = Directory.GetDirectories(rootDirectory);
        for (int i = 0; i < subDirectories.Length; i += 1)
        {
            string[] projectFiles = Directory.GetFiles(subDirectories[i]);
            for (int j = 0; j < projectFiles.Length; j += 1)
            {
                if (projectFiles[j].Contains("song_"))
                {
                    // Has a song file, so meets minimum requirements to be considered a project. Add to list.
                    projectDirectories.Add(subDirectories[i]);
                    break;
                }
            }
        }

        targetScroll = VoezEditor.projectScrollOff;

        // Setup drawing layers (order matters here)
        songsContainer      = new FContainer();
        foregroundContainer = new FContainer();
        Futile.stage.AddChild(songsContainer);
        Futile.stage.AddChild(foregroundContainer);
    }
Пример #8
0
    public MGame(MInGamePage page)
    {
        instance = this;
        this.page = page;
        this.container = page;

        _players.Add(new MPlayer(0, true,"YOU",MColor.Green));
        _players.Add(new MPlayer(1, false,"RED",MColor.Red));
        _players.Add(new MPlayer(2, false,"BLUE",MColor.Blue));

        _ais.Add (new MPlayerAI(_players[1], _players));
        _ais.Add (new MPlayerAI(_players[2], _players));

        _human = _players[0];

        _beasts = new MBeast[_players.Count * (_human.maxBeasts + 20)];

        CreateTowers();

        container.AddChild(_beastContainer = new FContainer());
        container.AddChild(_beastContainerSpecial = new FContainer());

        container.AddChild(effectLayer = new MEffectLayer());

        container.AddChild(hudLayer = new FContainer());

        CreateUI();

        Futile.instance.SignalUpdate += HandleUpdate;
        Futile.touchManager.AddMultiTouchTarget(this);

        ShowNote("CLICK TO MOVE THE GREEN GUYS!\nDESTROY THE ENEMY CELLS!\nEVOLVE BY USING DNA!",10.0f);
    }
Пример #9
0
        public void ctor(HUD.HUD hud, FContainer fContainer)
        {
            Type[] constructorSignature = new Type[1];
            constructorSignature[0] = typeof(HUD.HUD);
            RuntimeMethodHandle handle = typeof(HudPart).GetConstructor(constructorSignature).MethodHandle;

            RuntimeHelpers.PrepareMethod(handle);
            IntPtr           ptr   = handle.GetFunctionPointer();
            Action <HUD.HUD> funct = (Action <HUD.HUD>)Activator.CreateInstance(typeof(Action <HUD.HUD>), this, ptr);

            funct(hud);//HudPart Constructor
            this.lastPos = this.pos;

            if (hud.owner != null & hud.owner is Player)
            {
                if (MonklandSteamManager.isInGame)
                {
                    this.circles = new HUDCircle[MonklandSteamManager.WorldManager.cycleLength / 1200];
                }
                else
                {
                    this.circles = new HUDCircle[(hud.owner as Player).room.world.rainCycle.cycleLength / 1200];
                }
            }
            else if (hud.owner != null & (hud.owner is MultiplayerSleepAndDeathScreen) && MonklandSteamManager.isInGame && MonklandSteamManager.WorldManager != null)
            {
                this.circles = new HUDCircle[MonklandSteamManager.WorldManager.cycleLength / 1200];
            }
            for (int i = 0; i < this.circles.Length; i++)
            {
                this.circles[i] = new HUDCircle(hud, HUDCircle.SnapToGraphic.smallEmptyCircle, fContainer, 0);
            }
        }
Пример #10
0
    override public void Start()
    {
        float spreadX = 125;
        //float startY = -TeamCol.HEIGHT/2-200;

        float colY = -20.0f;

        TeamCol col = new TeamCol(PlayerManager.Team_None);

        cols.Add(col);
        AddChild(col);
        col.y = colY;

        col   = new TeamCol(PlayerManager.Team_Wolves);
        col.x = -spreadX;
        cols.Add(col);
        AddChild(col);
        col.y = colY;

        col   = new TeamCol(PlayerManager.Team_Villagers);
        col.x = spreadX;
        cols.Add(col);
        AddChild(col);
        col.y = colY;

        rowHolder   = new FContainer();
        rowHolder.y = colY;
        AddChild(rowHolder);

        foreach (var player in Core.playerManager.players)
        {
            HandleOnPlayerAdded(player);
        }



        Core.playerManager.OnPlayerAdded   += HandleOnPlayerAdded;
        Core.playerManager.OnPlayerRemoved += HandleOnPlayerRemoved;

        if (Config.SHOULD_AUTO_SELECT_TEAMS || Config.SHOULD_SKIP_PLAYER_SELECT)
        {
            for (int r = 0; r < rows.Count; r++)
            {
                rows[r].player.team = r % 2 == 0 ? PlayerManager.Team_Wolves : PlayerManager.Team_Villagers;
            }
        }

        for (int r = 0; r < rows.Count; r++)
        {
            rows[r].player.team = PlayerManager.Team_None;
            rows[r].inner.x     = GetColForTeam(rows[r].player.team).x;
        }

        CheckStatus();

        if (Config.SHOULD_SKIP_PLAYER_SELECT)
        {
            StartGame();
        }
    }
Пример #11
0
 public InterfaceObject(MenuFlow menu)
 {
     _menu      = menu;
     _elements  = new List <InterfaceObject>();
     _size      = new Vector2(100f, 100f);
     _container = new FContainer();
 }
Пример #12
0
    override public void Start()
    {
        ListenForUpdate(HandleUpdate);

        st = new SimpleTimer();
        st.Start();

        gameNodes = new FContainer();
        Futile.atlasManager.LoadImage("car");

        WEHTiled hurr = new WEHTiled("track");

        gameNodes.AddChild(hurr.DrawLayer(0));
        FContainer coll = hurr.DrawLayer(1);

        gameNodes.AddChild(coll);

        c          = new Car(Futile.atlasManager.GetElementWithName("car"), coll);
        c.x        = Futile.screen.width;
        c.y        = -Futile.screen.height;
        c.rotation = 90;
        gameNodes.AddChild(c);

        lapCollider        = new FSprite(Futile.whiteElement);
        lapCollider.scaleY = 5;
        lapCollider.SetPosition(1220, -832);
        lapCollider.alpha = 0;
        gameNodes.AddChild(lapCollider);

        RXWatcher.Watch(gameNodes);
        RXWatcher.Watch(lapCollider);

        this.AddChild(gameNodes);
        SetupUI();
    }
Пример #13
0
    void ShowMessage(string title, string message, Color color)
    {
        FContainer callout = new FContainer();

        callout.scale = 0.5f;

        DualLabel titleLabel = new DualLabel(TOFonts.MEDIUM_BOLD, title);

        callout.AddChild(titleLabel);
        titleLabel.mainLabel.color = color;
        titleLabel.scale           = 4.0f;
        titleLabel.y              = 20.0f;
        titleLabel.shadowLabel.y += 0.5f;

        DualLabel messageLabel = new DualLabel(TOFonts.MEDIUM_BOLD, message);

        callout.AddChild(messageLabel);
        messageLabel.mainLabel.color = color;
        messageLabel.scale           = 2.0f;
        messageLabel.y = -16.0f;

        Arena.instance.frontContainer.AddChild(callout);

        titleLabel.alpha   = 0;
        messageLabel.alpha = 0;

        Go.to(titleLabel, 0.5f, new TweenConfig().alpha(1.0f));
        Go.to(messageLabel, 0.5f, new TweenConfig().alpha(1.0f));

        Go.to(callout, 3.0f, new TweenConfig().y(10.0f).removeWhenComplete());
        Go.to(callout, 0.8f, new TweenConfig().setDelay(2.2f).alpha(0.0f));
    }
Пример #14
0
    override public void Start()
    {
        Futile.atlasManager.LoadImage("chopper");
        Futile.atlasManager.LoadImage("man");

        this.AddChild(persons = new FContainer());

        ListenForUpdate(HandleUpdate);
        root = FPWorld.Create(64.0f);


        for (int i = 0; i < 50; i++)
        {
            Platform p = Platform.Create();
            p.Init(new Vector2(i * 250, RXRandom.Range(-100, 100) * i), this);
            Person b = Person.Create();
            b.Init(new Vector2(p.sprite.x, p.sprite.y + 532), this);
            b.GameOver = HandleGameOver;
        }


        c = Chopper.Create();
        c.Init(new Vector2(0, 128), this);

        RXWatcher.Watch(this);
        Futile.stage.Follow(c.sprite, false, false);
    }
Пример #15
0
    public void setupMenu()
    {
        FContainer menuSelector = new FContainer();
        menuSelector.x = Futile.screen.width * 0.3f;
        menuSelector.y = -Futile.screen.height * 0.2f;

        selector.color = tone1;
        selector.height = 48;
        selector.width = Futile.screen.width * 2;
        menuSelector.AddChild(selector);

        FButton toAdd;

        toAdd = addButton("Play");
        menuSelector.AddChild(toAdd);
        toAdd = addButton("Options");
        toAdd.y -= 48;
        menuSelector.AddChild(toAdd);
        toAdd = addButton("Exit");
        toAdd.y -= 96;
        menuSelector.AddChild(toAdd);

        this.AddChild(menuSelector);
        menuElements[0].label.color = tone2;
    }
Пример #16
0
    public GamePage()
    {
        // create dungeon
        _dungeon = new Dungeon(20);

        // add the dungeon/game portion of the screen
        Dungeon_Container = new FContainer();
        AddChild (Dungeon_Container);

        // add current room
        Dungeon_Container.AddChild(_dungeon.CurrentRoom);

        // create player
        int px = (int)_dungeon.CurrentRoom.playerSpawnBox.box.x;
        int py = (int)_dungeon.CurrentRoom.playerSpawnBox.box.y;
        player = new Player(px, py);
        Dungeon_Container.AddChild(player);

        // reposition dungeon container to make room for UI
        Dungeon_Container.y = DUNGEON_CONTAINER_OFFSET;

        // add the UI portion of the screen
        AddChild (UI_Manager.getGameUIContainer(this));

        // *** debug to find collision boxes
        //showCollisionsWithMen();

        this.scale = 1;
    }
Пример #17
0
    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);
        }
    }
Пример #18
0
    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);
    }
Пример #19
0
 public override void AddToContainer(SpriteGroup sGroup, FContainer newContainer)
 {
     for (int i = 0; i < labels.Length; i += 1)
     {
         newContainer.AddChild(labels[i]);
     }
 }
Пример #20
0
    public RoomCamera(Game game)
    {
        this.game = game;

        //初始化相机位置
        room    = null;
        pos     = new Vector2(0.0f, 0.0f);
        lastPos = pos;

        //FContainer,添加到Futile引擎的Stage
        SpriteLayers = new FContainer[6];
        for (int index = 0; index < SpriteLayers.Length; ++index)
        {
            SpriteLayers[index] = new FContainer();
            Futile.stage.AddChild(SpriteLayers[index]);
        }
        //Sprite层级和索引字典
        SpriteLayerIndex = new Dictionary <string, int>();
        SpriteLayerIndex.Add("Background", 0);
        SpriteLayerIndex.Add("Midground", 1);
        SpriteLayerIndex.Add("Items", 2);
        SpriteLayerIndex.Add("Foreground", 3);
        SpriteLayerIndex.Add("HUD", 4);
        SpriteLayerIndex.Add("HUD2", 5);
        //实例化关卡纹理
        levelGraphic         = new FSprite(Configs.LEVEL_PATH, true);
        levelGraphic.anchorX = 0.0f;
        levelGraphic.anchorY = 0.0f;
        ReturnFContainer("Foreground").AddChild(levelGraphic);
    }
Пример #21
0
    public override void Start()
    {
        root = FPWorld.Create(64.0f);
        screenCenter=new Vector2(Futile.screen.halfWidth,Futile.screen.halfHeight);
        ListenForUpdate(Update);
        _gameObjects = new FContainer();
        AddChild(_gameObjects);
        _enemyContainer = new FContainer();
        AddChild(_enemyContainer);
        AddChild(impactParticles = new FParticleSystem(40));
        AddChild(projectilesParticles = new FParticleSystem(300));
        _playerBullets = new FContainer();
        AddChild(_playerBullets);

        t = Time.time;

        CreateWorld();
        InitPlayer();
        scoreLabel = new FLabel("font", "Score = "+ Score);
        gameOver = new FLabel("font", "Game Over, press 'R' to try again!");
        scoreLabel.SetAnchor(new Vector2(0,-10));
        AddChild(scoreLabel);

        FSoundManager.PlayMusic("Barymag");
        FSoundManager.isMuted=false;
    }
Пример #22
0
        public void AddToContainer(RoomCamera.SpriteLeaser sLeaser, RoomCamera rCam, FContainer newContatiner)
        {
            if (newContatiner == null)
            {
                switch (this.assetName)
                {
                case "Tr_PipesA":
                    newContatiner = rCam.ReturnFContainer("Foreground");
                    break;

                case "Tr_PipesB":
                    newContatiner = rCam.ReturnFContainer("ForegroundLights");
                    break;

                case "Tr_PipesC":
                    newContatiner = rCam.ReturnFContainer("Shortcuts");
                    break;

                default:
                    newContatiner = rCam.ReturnFContainer("Shortcuts");
                    break;
                }
            }
            foreach (FSprite fsprite in sLeaser.sprites)
            {
                fsprite.RemoveFromContainer();
                newContatiner.AddChild(fsprite);
            }
        }
Пример #23
0
    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();
    }
Пример #24
0
    public void GoToTitlePage()
    {
        if (_currentPage != null) _currentPage.RemoveFromContainer();

        _currentPage = new TitlePage();
        Futile.stage.AddChild(_currentPage);
    }
Пример #25
0
        public void AddToContainer(RoomCamera.SpriteLeaser sLeaser, RoomCamera rCam, FContainer newContatiner)
        {
            if (newContatiner == null)
            {
                switch (uglyWorkAroundName)
                {
                case "Tr_TankWall":
                    newContatiner = rCam.ReturnFContainer("Foreground");
                    break;

                case "Tr_TankShadow1":
                    newContatiner = rCam.ReturnFContainer("ForegroundLights");
                    break;

                case "Tr_TankShadow":
                    newContatiner = rCam.ReturnFContainer("Shortcuts");
                    break;

                default:
                    newContatiner = rCam.ReturnFContainer("Shortcuts");
                    break;
                }
            }
            foreach (FSprite fsprite in sLeaser.sprites)
            {
                fsprite.RemoveFromContainer();
                newContatiner.AddChild(fsprite);
            }
        }
Пример #26
0
    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);
    }
Пример #27
0
    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;
    }
Пример #28
0
 public Car(FAtlasElement element, FContainer grid) : base(element)
 {
     ListenForUpdate(Update);
     Speed     = 0;
     Colliders = grid;
     FSoundManager.PlayMusic("loop_0");
 }
Пример #29
0
    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);
    }
Пример #30
0
        public MonklandUI(FStage stage)
        {
            displayMessages = new List <QuickDisplayMessage>();
            uiLabels        = new List <FLabel>();
            worldStage      = stage;

            uiContainer = new FContainer();

            string text = "Monkland " + Monkland.VERSION;

            if (!MonklandSteamManager.DEBUG)
            {
                text = "";
            }

            statusLabel           = new FLabel("font", text);
            statusLabel.alignment = FLabelAlignment.Left;
            statusLabel.SetPosition(50.01f, Futile.screen.height - 49.99f);
            uiContainer.AddChild(statusLabel);

            for (int i = 0; i < 200; i++)
            {
                FLabel displayLabel = new FLabel("font", "");
                displayLabel.alignment = FLabelAlignment.Left;
                uiContainer.AddChild(displayLabel);
                uiLabels.Add(displayLabel);
            }

            displayMessages.Clear();
            stage.AddChild(uiContainer);
        }
Пример #31
0
    public Vector2 GetPositionRelativeToAncestor(FContainer ancestor)
    {
        FNode target = this;

        Vector2 position = new Vector2(0, 0);

        FContainer container;

        while (true)
        {
            position += target.GetPosition();
            container = target.container;
            if (container == null)
            {
                break;
            }
            if (container == ancestor)
            {
                break;
            }
            target = container;
        }

        return(position);
    }
Пример #32
0
    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);
    }
Пример #33
0
    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();
    }
Пример #34
0
    public SlotList(float width, float height)
    {
        _width  = width;
        _height = height;

        touchableRect = new Rect(-_width / 2, -10000, _width - Config.SLOT_HEIGHT * 2 - Config.PADDING_XS * 2, 20000);//infinite height because thaat's how i doooo

        _scroller = new RXScroller(0, _minScrollY, _maxScrollY);

        _touchSlot = Futile.touchManager.GetTouchSlot(0);

        AddChild(slotContainer = new FContainer());

        List <Player> players = SKDataManager.GetPlayers();

        for (int p = 0; p < players.Count; p++)
        {
            AddSlotForPlayer(players[p], false);
        }

        Reorder(false, false);

        ListenForUpdate(HandleUpdate);

        _isInitializing = false;
    }
Пример #35
0
    public void ctor(HUD.HUD hud, FContainer fContainer)
    {
        Type[] constructorSignature = new Type[1];
        constructorSignature[0] = typeof(HUD.HUD);
        RuntimeMethodHandle handle = typeof(HudPart).GetConstructor(constructorSignature).MethodHandle;

        RuntimeHelpers.PrepareMethod(handle);
        IntPtr           ptr   = handle.GetFunctionPointer();
        Action <HUD.HUD> funct = (Action <HUD.HUD>)Activator.CreateInstance(typeof(Action <HUD.HUD>), this, ptr);

        funct(hud);//HudPart Constructor
        this.lastPos = this.pos;

        if (hud.owner != null & hud.owner is Player)
        {
            this.circles = new HUDCircle[(hud.owner as Player).room.world.rainCycle.cycleLength / 1200];
        }
        else if (hud.owner != null & (hud.owner is patch_SleepAndDeathScreen))
        {
            this.circles = new HUDCircle[(hud.owner as patch_SleepAndDeathScreen).nextcycleLength / 1200];
        }
        for (int i = 0; i < this.circles.Length; i++)
        {
            this.circles[i] = new HUDCircle(hud, HUDCircle.SnapToGraphic.smallEmptyCircle, fContainer, 0);
        }
        if (hud.owner != null & hud.owner is Player)
        {
            if (((hud.owner as Player).room.world.rainCycle as patch_RainCycle).getBurstIndex(0) < this.circles.Length)
            {
                (this.circles[((hud.owner as Player).room.world.rainCycle as patch_RainCycle).getBurstIndex(0)] as patch_HUDCircle).danger = true;
            }
            if (((hud.owner as Player).room.world.rainCycle as patch_RainCycle).getBurstIndex(1) < this.circles.Length)
            {
                (this.circles[((hud.owner as Player).room.world.rainCycle as patch_RainCycle).getBurstIndex(1)] as patch_HUDCircle).danger = true;
            }
            if (((hud.owner as Player).room.world.rainCycle as patch_RainCycle).getBurstIndex(2) < this.circles.Length)
            {
                (this.circles[((hud.owner as Player).room.world.rainCycle as patch_RainCycle).getBurstIndex(2)] as patch_HUDCircle).danger = true;
            }
        }
        else if (hud.owner != null & !(hud.owner is Player) & (hud.owner is patch_SleepAndDeathScreen))
        {
            if ((hud.owner as patch_SleepAndDeathScreen).getBurst(0) < this.circles.Length)
            {
                (this.circles[(hud.owner as patch_SleepAndDeathScreen).getBurst(0)] as patch_HUDCircle).danger = true;
            }
            if ((hud.owner as patch_SleepAndDeathScreen).getBurst(1) < this.circles.Length)
            {
                (this.circles[(hud.owner as patch_SleepAndDeathScreen).getBurst(1)] as patch_HUDCircle).danger = true;
            }
            if ((hud.owner as patch_SleepAndDeathScreen).getBurst(2) < this.circles.Length)
            {
                (this.circles[(hud.owner as patch_SleepAndDeathScreen).getBurst(2)] as patch_HUDCircle).danger = true;
            }
            (hud.owner as patch_SleepAndDeathScreen).nextcycleLength  = (hud.owner as patch_SleepAndDeathScreen).nextcycleLength2;
            (hud.owner as patch_SleepAndDeathScreen).nextcycleLength2 = (hud.owner as patch_SleepAndDeathScreen).nextcycleLength3;
            (hud.owner as patch_SleepAndDeathScreen).burstNum         = (hud.owner as patch_SleepAndDeathScreen).burstNum2;
            (hud.owner as patch_SleepAndDeathScreen).burstNum2        = (hud.owner as patch_SleepAndDeathScreen).burstNum3;
        }
    }
Пример #36
0
    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);
    }
Пример #37
0
    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;
    }
Пример #38
0
    public Keeper()
    {
        instance = this;

        SKDataManager.LoadData();

        CellManager.Recalculate();

        AddChild(mainContainer = new FContainer());

        SetupMegaBoxes();

        mainContainer.AddChild(slotList = new SlotList(Config.LIST_WIDTH, Config.HEIGHT));

        AddChild(effectContainer = new FContainer());

        slotList.SignalPlayerChange += HandlePlayerChange;

        HandlePlayerChange();

        Futile.screen.SignalResize       += HandleSignalResize;
        Futile.instance.SignalLateUpdate += HandleLateUpdate;

        FSoundManager.PlaySound("UI/Start");
    }
Пример #39
0
        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 ();
        }
Пример #40
0
        /// <summary>
        /// Do not use this directly.
        /// Size is fixed to 150f, 150f.
        /// </summary>
        /// <param name="pos">Position</param>
        /// <param name="type">Creature Type</param>
        public UIcreature(Vector2 pos, CreatureTemplate.Type type) : base(pos, new Vector2(150f, 150f))
        {
            _inBox = true;
            if (!init)
            {
                return;
            }

            this.rect = new DyeableRect(menu, owner, pos + offset, size, true);
            this.subObjects.Add(this.rect);
            //owner.subObjects.Add(this.menuObj);

            this._type = type;

            cage = new FContainer();
            this.myContainer.AddChild(cage);
            cage.SetPosition(new Vector2(75f, 20f));
            fence = new FContainer();
            this.myContainer.AddChild(fence);
            fence.SetPosition(new Vector2(75f, 20f));
            fence.MoveToFront();

            absTemplate       = new OptionalCreatureTemplate(type);
            absCreature       = new OptionalAbstractCreature(world, absTemplate);
            absCreature.state = new OptionalCreatureState(absCreature);
        }
Пример #41
0
    public GamePage()
    {
        // create dungeon
        _dungeon = new Dungeon(20);

        // add the dungeon/game portion of the screen
        Dungeon_Container = new FContainer();
        AddChild(Dungeon_Container);

        // add current room
        Dungeon_Container.AddChild(_dungeon.CurrentRoom);

        // create player
        int px = (int)_dungeon.CurrentRoom.playerSpawnBox.box.x;
        int py = (int)_dungeon.CurrentRoom.playerSpawnBox.box.y;

        player = new Player(px, py);
        Dungeon_Container.AddChild(player);

        // reposition dungeon container to make room for UI
        Dungeon_Container.y = DUNGEON_CONTAINER_OFFSET;

        // add the UI portion of the screen
        AddChild(UI_Manager.getGameUIContainer(this));

        // *** debug to find collision boxes
        //showCollisionsWithMen();

        this.scale = 1;
    }
Пример #42
0
    public VillDeathCloud(Vill vill) : base(vill.entityArea)
    {
        this.vill = vill;

        this.x = vill.x;
        this.y = vill.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  = vill.player.player.color.color + new Color(0.1f, 0.1f, 0.1f, 0.0f);

        graveHolder = new FContainer();
        graveSprite = new FSprite("Arena/VillGrave1_body");
        graveHolder.AddChild(graveSprite);
        graveSpriteColor = new FSprite("Arena/VillGrave1_color");
        graveHolder.AddChild(graveSpriteColor);
        graveSpriteColor.color = vill.player.player.color.color + new Color(0.5f, 0.5f, 0.5f);

        graveSprite.y = graveSpriteColor.y = 5;

        Update();
    }
Пример #43
0
    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);
    }
Пример #44
0
    override public void Start()
    {
        root         = FPWorld.Create(64.0f);
        screenCenter = new Vector2(Futile.screen.halfWidth, Futile.screen.halfHeight);
        ListenForUpdate(Update);
        _gameObjects = new FContainer();
        AddChild(_gameObjects);
        _enemyContainer = new FContainer();
        AddChild(_enemyContainer);
        AddChild(impactParticles      = new FParticleSystem(40));
        AddChild(projectilesParticles = new FParticleSystem(300));
        _playerBullets = new FContainer();
        AddChild(_playerBullets);

        t = Time.time;

        CreateWorld();
        InitPlayer();
        scoreLabel = new FLabel("font", "Score = " + Score);
        gameOver   = new FLabel("font", "Game Over, press 'R' to try again!");
        scoreLabel.SetAnchor(new Vector2(0, -10));
        AddChild(scoreLabel);

        FSoundManager.PlayMusic("Barymag");
        FSoundManager.isMuted = false;
    }
Пример #45
0
    public void setupMenu()
    {
        FContainer menuSelector = new FContainer();

        menuSelector.x = Futile.screen.width * 0.3f;
        menuSelector.y = -Futile.screen.height * 0.2f;

        selector.color  = tone1;
        selector.height = 48;
        selector.width  = Futile.screen.width * 2;
        menuSelector.AddChild(selector);

        FButton toAdd;

        toAdd = addButton("Play");
        menuSelector.AddChild(toAdd);
        toAdd    = addButton("Options");
        toAdd.y -= 48;
        menuSelector.AddChild(toAdd);
        toAdd    = addButton("Exit");
        toAdd.y -= 96;
        menuSelector.AddChild(toAdd);

        this.AddChild(menuSelector);
        menuElements[0].label.color = tone2;
    }
Пример #46
0
    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);
    }
    // Use this for initialization
    void Start()
    {
        FutileParams fParms = new FutileParams(false, false, true, true);

        fParms.AddResolutionLevel(1024.0f, 1.0f, 1.0f, "");
        fParms.origin = new Vector2(0.5f, 0.5f);
        Futile.instance.Init(fParms);

        Futile.atlasManager.LoadAtlas("Atlases/art");
        Futile.atlasManager.LoadFont("Franchise", "FranchiseFontAtlas.png", "Atlases/FranchiseLarge");

        FSprite background = new FSprite("background.png");

        Futile.stage.AddChild(background);
        Futile.stage.AddChild(mBombaNode  = new FContainer());
        Futile.stage.AddChild(mPepperNode = new FContainer());

        mPepperNode.AddChild(mPepper = new Pepper(new FireDelegate(fire)));

        mSeed = new Seed(18, mPepper.y + mPepper.height / 2 - 15);
        Futile.stage.AddChild(mSeed);

        mScoreLabel         = new FLabel("Franchise", "Score :");
        mScoreLabel.anchorX = 0;
        mScoreLabel.anchorY = 1;
        mScoreLabel.color   = new Color(1.0f, 0.90f, 0.0f);
        mScoreLabel.x       = -Futile.halfWidth;
        mScoreLabel.y       = Futile.halfHeight;

        Futile.stage.AddChild(mScoreLabel);

        Futile.touchManager.AddSingleTouchTarget(this);

        FSoundManager.PlayMusic("music", 0.45f);
    }
    public static FPDebugRenderer Create(GameObject targetGameObject, FContainer container, uint color, bool shouldUpdateColliders)
    {
        if(!IS_ENABLED) return null;

        FPDebugRenderer debugRenderer = targetGameObject.AddComponent<FPDebugRenderer>();
        debugRenderer.Init(container, color, shouldUpdateColliders);
        return debugRenderer;
    }
Пример #49
0
 public SBEntity(string name)
 {
     this.name = name;
     rotatingContainer = new FContainer();
     AddChild(rotatingContainer);
     components = new List<SBAbstractComponent>();
     spriteComponents = new List<SBSpriteComponent>();
 }
    public void Init(FContainer container, uint color, bool shouldUpdateColliders)
    {
        _container = container;

        _container.AddChild(_drawHolder = new FContainer());

        _color = RXUtils.GetColorFromHex(color);

        this.shouldUpdateColliders = shouldUpdateColliders;

        Collider[] colliders = gameObject.GetComponents<Collider>();

        int colliderCount = colliders.Length;

        for(int c = 0; c<colliderCount; c++)
        {
            Collider collider = colliders[c];

            FNode newNode = null;

            if(collider is BoxCollider)
            {
                FSprite sprite = new FSprite("Debug/Square");
                sprite.color = _color;

                newNode = sprite;
            }
            else if(collider is SphereCollider)
            {
                FSprite sprite = new FSprite("Debug/Circle");
                sprite.color = _color;

                newNode = sprite;
            }

            if(newNode != null)
            {
                _drawHolder.AddChild(newNode);
                _nodes.Add(newNode);
            }
        }

        FPPolygonalCollider mesh2D = gameObject.GetComponent<FPPolygonalCollider>();

        if(mesh2D != null)
        {
            FPDebugPolygonColliderView debugView = new FPDebugPolygonColliderView("Debug/Triangle", mesh2D);
            debugView.color = _color;

            _drawHolder.AddChild(debugView);
            _nodes.Add(debugView);
        }

        Update();
        if(!shouldUpdateColliders) UpdateColliders(); //always update the colliders the first time
    }
Пример #51
0
    public override void purge()
    {
        mStarted = false;

        RemoveChild( counter );
        counter = null;

        mContainer.RemoveAllChildren();
        mContainer = null;
    }
Пример #52
0
    void SetupScroller()
    {
        FRepeatSprite rs = new FRepeatSprite("drumstick2", Futile.screen.width*2, Futile.screen.height*2);
        FContainer scrollContainer = new FContainer();
        scrollContainer.AddChild(rs);
        this.AddChild(scrollContainer);

        Go.to( scrollContainer, 10f, new TweenConfig()
                .floatProp("rotation", 360)
                .setIterations( -1, LoopType.RestartFromBeginning ));
    }
Пример #53
0
 public Heart()
     : base()
 {
     body = new FContainer ();
     bodySprite = new FSprite ("Game/heart");
     body.AddChild (bodySprite);
     /*
     this.Collider = new Circle (bodySprite.width / 2, xx, yy);
     this.quad = new Quad(this.Collider.Left, this.Collider.Bottom, this.Collider.Right, this.Collider.Top);
     entityContainer.quadTree.Insert(Collider, ref quad);*/
 }
Пример #54
0
    public static void SwitchToPage(PageType pageType)
    {
        if (currentPage != null) currentPage.RemoveFromContainer();

        if (pageType == PageType.Title) currentPage = new TitlePage();
        else if (pageType == PageType.Game) currentPage = new GamePage();

        currentPage.x = 0;
        currentPage.y = 0;
        Futile.stage.AddChild(currentPage);
    }
Пример #55
0
    public Blocker(FContainer containerToUse, float blockAlpha)
        : base("Box")
    {
        _containerToUse = containerToUse;

        sprite.width = Config.WIDTH;
        sprite.height = Config.HEIGHT;
        sprite.color = new Color(0.05f,0.05f,0.1f); //very dark blue
        sprite.alpha = blockAlpha;
        this.alpha = 0.0f;
    }
Пример #56
0
 public GamePage()
 {
     HeadsUpDisplay = new FContainer();
     Debug.Log("In game page");
     FSprite bg = new FSprite("Futile_White");
     bg.color = Color.black;
     bg.width = Futile.screen.width;
     bg.height = Futile.screen.height;
     AddChild(bg);
     bg.SetPosition(new Vector2(Futile.screen.width / 2, Futile.screen.height/2));
 }
Пример #57
0
        public EffectManager(bool hasParticles)
        {
            this.hasParticles = hasParticles;

            AddChild (flyCoinContainer = new FContainer ());

            if (hasParticles) {
                AddChild (particleSystem = new FParticleSystem (60));
                particleSystem.shader = FShader.Additive;
            }
        }
Пример #58
0
    public EntityArea()
    {
        AddChild(shadowContainer = new FContainer());
        AddChild(backContainer = new FContainer());
        AddChild(sortYContainer = new FSortYContainer());
        AddChild(overlayContainer = new FContainer());
        AddChild(frontContainer = new FContainer());
        AddChild(uiContainer = new FContainer());

        ListenForUpdate(HandleUpdate);
    }
Пример #59
0
    public override void build()
    {
        mContainer = new FContainer();
        AddChild( mContainer );

        counter = new Counter();
        counter.title = "COUNT";
        AddChild( counter );

        mFrameCount = 0;
        mWaitFrames = 1;
        mStarted = true;
    }
Пример #60
0
    public House(float x, float y, EntityArea entityArea)
        : base(entityArea)
    {
        this.x = x;
        this.y = y;

        main = new FContainer();
        mainSprite = new FSprite("Arena/House_1");
        mainSprite.y = -offsetY;
        main.AddChild(mainSprite);

        blockingRect = new TORect(x-40,y-24,80,42);
    }