void Start()
    {
        instance = this;

        FutileParams fparams = new FutileParams(true, true, false, false);

        fparams.AddResolutionLevel(1280.0f, 1.0f, 1.0f, "");
        fparams.origin = new Vector2(0.5f, 0.5f);

        Futile.instance.Init(fparams);

        Futile.atlasManager.LoadAtlas("Atlases/CombatAtlas");

        Futile.atlasManager.LoadAtlas("Atlases/stomach_atlas");

        Futile.atlasManager.LoadAtlas("Atlases/lung_background");
        Futile.atlasManager.LoadAtlas("Atlases/lung_layers");
        Futile.atlasManager.LoadAtlas("Atlases/lung_dust");

        Futile.atlasManager.LoadAtlas("Atlases/BrainAtlas");
        Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_80_animation");
        Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_60_animation");
        Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_40_animation");
        Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_80_animation");
        Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_60_animation");
        Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_40_animation");

        Futile.atlasManager.LoadAtlas ("Atlases/Victory-DefeatAtlas");

        FSoundManager.PreloadSound("player_hit");
        FSoundManager.PreloadSound("bacteria_pop");

        Futile.atlasManager.LogAllElementNames();

        stage_ = Futile.stage;

        camera_ = new FCamObject();
        stage_.AddChild(camera_);

        //Rect worldBounds = stage.worldBounds;
        camera_.setWorldBounds (worldBounds);

        //make the camera follow the player

        camera_.setBounds(cameraBounds);

        gamePage = new CombatPage();
        gamePage.Start();
        camera_.AddChild(gamePage);
    }
    void Start()
    {
        instance = this;

        FutileParams fparams = new FutileParams(true, true, false, false);

        fparams.AddResolutionLevel(1280.0f, 1.0f, 1.0f, "");
        fparams.origin = new Vector2(0.5f, 0.5f);

        Futile.instance.Init(fparams);

        Futile.atlasManager.LoadAtlas("Atlases/CombatAtlas");


        Futile.atlasManager.LoadAtlas("Atlases/stomach_atlas");

        Futile.atlasManager.LoadAtlas("Atlases/lung_background");
        Futile.atlasManager.LoadAtlas("Atlases/lung_layers");
        Futile.atlasManager.LoadAtlas("Atlases/lung_dust");

        Futile.atlasManager.LoadAtlas("Atlases/BrainAtlas");
        Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_80_animation");
        Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_60_animation");
        Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_40_animation");
        Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_80_animation");
        Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_60_animation");
        Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_40_animation");

        Futile.atlasManager.LoadAtlas("Atlases/Victory-DefeatAtlas");

        FSoundManager.PreloadSound("player_hit");
        FSoundManager.PreloadSound("bacteria_pop");

        Futile.atlasManager.LogAllElementNames();

        stage_ = Futile.stage;

        camera_ = new FCamObject();
        stage_.AddChild(camera_);

        //Rect worldBounds = stage.worldBounds;
        //camera_.setWorldBounds (worldBounds);
        //camera_.setBounds(stage.cameraBounds);

        gamePage = new CombatPage();
        gamePage.Start();
        camera_.AddChild(gamePage);
    }
示例#3
0
        override public void OnEnter()
        {
            Tile[,] map_plan = MapMaker.generateMap();
            board            = new Board();
            board.initBoard(map_plan);

            player   = new Creature("You", "char-456");
            player.x = 10 * tw;
            player.y = 4 * th;
            Futile.stage.AddChild(player);
            board.addCreature(player);
            //player.color = UnityEngine.Color.yellow;

            fco = new FCamObject();
            fco.follow(player);
            fco.setWorldBounds(new Rect(-120, -80, 480, 30 * MainDemoScript.th));          //map_plan.GetLength(0)*MainDemoScript.th));
            fco.setBounds(new Rect(-240, -160,
                                   240, 160));
            AddChild(fco);


            Monster m = new Monster("Blood Mage", "char-460");

            m.str = 1;
            m.x   = 15 * tw; m.y = 12 * th;
            Futile.stage.AddChild(m);
            board.addCreature(m);
            creatures.Add(m);

            NPC knight = new NPC("Holy Knight", "char-466", "The heart of this cast\nle has become corrupted.");

            knight.x     = 16 * tw; knight.y = 5 * th;
            knight.color = UnityEngine.Color.yellow;
            Futile.stage.AddChild(knight);
            board.addCreature(knight);
            creatures.Add(knight);

            knight       = new NPC("Holy Knight", "char-466", "You should not enter.\nYou cannot save it.");
            knight.x     = 13 * tw; knight.y = 5 * th;
            knight.color = UnityEngine.Color.yellow;
            Futile.stage.AddChild(knight);
            board.addCreature(knight);
            creatures.Add(knight);

            for (int i = 0; i < map_plan.GetLength(0); i++)
            {
                for (int j = 0; j < map_plan.GetLength(1); j++)
                {
                    board.tilemap[i, j] = map_plan[i, j];
                    if (map_plan[i, j] != null)
                    {
                        AddChild(map_plan[i, j]);
                    }
                }
            }

            uibar         = new FSprite("uibar");
            uibar.anchorX = 0;
            uibar.anchorY = 1.0f;
            uibar.x       = 0;
            uibar.y       = Futile.screen.height;
            uibar.scaleY  = 0.8f;
            fco.AddChild(uibar);

            chatbar         = new FSprite("uibar");
            chatbar.anchorX = 0;
            chatbar.anchorY = 0;
            chatbar.x       = 0;
            chatbar.y       = 0;
            chatbar.scaleY  = 1.4f;
            chatbar.alpha   = 0f;
            fco.AddChild(chatbar);

            turnCounterLabel         = new FLabel("mainfont", "Turn " + turnNumber);
            turnCounterLabel.anchorX = 0;
            turnCounterLabel.anchorY = 1.0f;
            //turnCounterLabel.scale = 0.8f;
            //turnCounterLabel.scale = 0.5f;
            turnCounterLabel.x     = 4;
            turnCounterLabel.y     = Futile.screen.height - 2;
            turnCounterLabel.color = UnityEngine.Color.white;
            fco.AddChild(turnCounterLabel);

            timerLabel         = new FLabel("mainfont", "Tick");
            timerLabel.anchorX = 1.0f;
            timerLabel.anchorY = 1.0f;
            //timerLabel.scale = 0.8f;
            timerLabel.x     = Futile.screen.width - 4;
            timerLabel.y     = Futile.screen.height - 2;
            timerLabel.color = UnityEngine.Color.red;
            fco.AddChild(timerLabel);

            messageLabel         = new FLabel("mainfont", "");
            messageLabel.anchorX = 0f;
            messageLabel.anchorY = 0f;
            messageLabel.x       = 2f;
            messageLabel.y       = 4f;
            messageLabel.color   = UnityEngine.Color.white;
            fco.AddChild(messageLabel);

            gameOverLabel         = new FLabel("mainfont", "The Castle Falls Silent");
            gameOverLabel.anchorX = 0.5f;
            gameOverLabel.anchorY = 0.5f;
            gameOverLabel.x       = Futile.screen.width / 2;
            gameOverLabel.y       = Futile.screen.height / 2;
            gameOverLabel.color   = UnityEngine.Color.white;

            fco.MoveToFront();
            //Futile.stage.AddChild(gameOverLabel);
        }
示例#4
0
    public World(int level)
    {
        string beginningMessage = "";

        if (beginningMessages.Length > level)
        {
            beginningMessage = beginningMessages[level];
        }
        beginningLabel       = new FLabel("Large", beginningMessage);
        beginningLabel.alpha = 1.0f;
        beginningLabel.y     = -70;

        beginningLabelShadow       = new FLabel("Large", beginningMessage);
        beginningLabelShadow.color = Color.black;
        beginningLabelShadow.SetPosition(beginningLabel.GetPosition());

        beginningLabelShadow.x += 1;
        beginningLabelShadow.y += -1;


        this.currentLevelNum = level;
        string levelName = "Maps/map" + level;

        this.startNumPlayers = enemiesOnLevel[level];

        clock = new Clock();
        clock.enableSound();
        enemyClock = new EnemyClock();

        gui = new FCamObject();
        gui.AddChild(clock);
        gui.AddChild(enemyClock);

        setClock(clock);

        Futile.stage.AddChild(playerLayer);

        tmxMap.LoadTMX(levelName);
        tilemap = (FTilemap)(tmxMap.getLayerNamed("Tilemap"));

        FTilemap objectLayer = (FTilemap)(tmxMap.getLayerNamed("Objects"));

        for (int xInd = 0; xInd < objectLayer.widthInTiles; xInd++)
        {
            for (int yInd = 0; yInd < objectLayer.heightInTiles; yInd++)
            {
                switch (objectLayer.getFrameNum(xInd, yInd))
                {
                case 0:

                    break;

                case 10:
                    FNode newSpawn = new FNode();
                    newSpawn.x = xInd * tilemap._tileWidth + tilemap._tileWidth / 2;
                    newSpawn.y = -yInd * tilemap._tileHeight - tilemap._tileHeight / 2;
                    spawnPoints.Add(newSpawn);
                    break;

                case 11:
                    playerSpawn   = new FNode();
                    playerSpawn.x = xInd * tilemap._tileWidth + tilemap._tileWidth / 2;
                    playerSpawn.y = -yInd * tilemap._tileHeight - tilemap._tileHeight / 2;
                    break;
                }
            }
        }
        this.miniMap = new Minimap(this);
        playerLayer.AddChild(tmxMap);
        tilemap.clipNode = gui;

        Player player = new Player(true);

        gui.follow(player);
        addPlayer(player);
        player.setScale(2.0f, true);

        miniMap.setFollow(player);

        for (int ind = 0; ind < startNumPlayers; ind++)
        {
            Player p = new Player();
            addPlayer(p);
        }

        Futile.stage.AddChild(gui);

        gui.AddChild(new MuteMusicButton());
        gui.AddChild(miniMap);
        gui.AddChild(beginningLabelShadow);
        gui.AddChild(beginningLabel);
    }
示例#5
0
    public void Update()
    {
        if (beginCount < beginTime)
        {
            beginCount      += UnityEngine.Time.deltaTime;
            clock.percentage = 1.0f;
        }
        else if (beginningLabel.alpha > 0)
        {
            beginningLabel.alpha      -= .3f * UnityEngine.Time.deltaTime;
            beginningLabelShadow.alpha = beginningLabel.alpha;
        }
        enemyClock.percentage = (playerList.Count - 1) / startNumPlayers;
        if (playerList.Count == 1)
        {
            clock.disableClock();
            if (endScreen == null)
            {
                FSoundManager.PlaySound("win");
                endScreen = new LevelOverScreen(true, currentLevelNum + 1 >= enemiesOnLevel.Length);
                gui.AddChild(endScreen);
            }
            else
            {
                if (endScreen.readyToStart)
                {
                    Futile.instance.SignalUpdate -= Update;
                    Futile.stage.RemoveAllChildren();
                    if (this.currentLevelNum + 1 < enemiesOnLevel.Length)
                    {
                        World newWorld = new World(++this.currentLevelNum);
                        Futile.instance.SignalUpdate += newWorld.Update;
                    }
                    else
                    {
                        TitleScreen titleScreen = new TitleScreen();
                        Futile.stage.AddChild(titleScreen);
                    }
                }
            }
        }
        else if (clock.percentage <= 0)
        {
            if (endScreen == null)
            {
                FSoundManager.PlaySound("lose");
                endScreen = new LevelOverScreen(false);
                gui.AddChild(endScreen);
            }
            else
            {
                endScreen.MoveToFront();
                if (endScreen.readyToStart)
                {
                    Futile.instance.SignalUpdate -= Update;
                    Futile.stage.RemoveAllChildren();

                    World newWorld = new World(this.currentLevelNum);
                    Futile.instance.SignalUpdate += newWorld.Update;
                }
            }
        }
        for (int ind = 0; ind < powerups.Count; ind++)
        {
            Powerup powerup = powerups[ind];
            foreach (Player p in playerList)
            {
                if (p.isControlled)
                {
                    if (powerup.checkCollision(p))
                    {
                        FSoundManager.PlaySound("powerup");
                        p.collectPowerUp(powerup.PType);
                        powerup.RemoveFromContainer();
                        powerups.Remove(powerup);
                        ind--;
                    }
                }
            }
        }
        for (int ind = 0; ind < bulletList.Count; ind++)
        {
            Bullet b = bulletList[ind];
            b.Update();
            for (int playerInd = 0; playerInd < playerList.Count; playerInd++)
            {
                Player p = playerList[playerInd];
                if (clock.percentage > 0 && b.checkCollision(p))
                {
                    p.setScale(p.scale - 1.0f, false);
                    if (p.scale <= 0)
                    {
                        FSoundManager.PlaySound("dead", .3f);
                        p.RemoveFromContainer();
                        playerList.Remove(p);
                        playerInd--;
                        FloatIndicator floatInd = new FloatIndicator("+00:00:0" + p.secondValue, p.GetPosition());
                        playerLayer.AddChild(floatInd);
                        clock.percentage += p.secondValue / 10.0f;      //Add the seconds to the clock
                        if (p.secondValue == 3)
                        {
                            float   powerupChance = RXRandom.Float();
                            Powerup powerup       = null;
                            if (powerupChance < .4f)
                            {
                                powerup = new Powerup(Powerup.PowerupType.MACHINEGUN);
                            }
                            else if (powerupChance < .8f)
                            {
                                powerup = new Powerup(Powerup.PowerupType.SHOTGUN);
                            }
                            if (powerup != null)
                            {
                                powerups.Add(powerup);
                                powerup.SetPosition(p.GetPosition());
                                playerLayer.AddChild(powerup);
                            }
                        }
                    }
                    else
                    {
                        FSoundManager.PlaySound("hit", .3f);
                    }
                    b.RemoveFromContainer();
                    bulletList.Remove(b);
                    ind--;
                    break;
                }
                else
                if (tilemap.getFrameNum((int)(b.x / tilemap._tileWidth), (int)(-b.y / tilemap._tileHeight)) == 1)
                {
                    b.RemoveFromContainer();
                    bulletList.Remove(b);
                    ind--;
                    break;
                }
            }
        }
    }
    void Start()
    {
        instance = this;

        FutileParams fparams = new FutileParams(true, true, false, false);

        fparams.AddResolutionLevel(1280.0f, 1.0f, 1.0f, "");
        fparams.origin = new Vector2(0.5f, 0.5f);

        Futile.instance.Init(fparams);

        Futile.atlasManager.LoadAtlas("Atlases/HuroCombatAtlas");
        Futile.atlasManager.LoadAtlas("Atlases/EnemyCombatAtlas");

        if (stage_name.Equals("stomach"))
        {
            Futile.atlasManager.LoadAtlas("Atlases/StomachAtlas1");
            Futile.atlasManager.LoadAtlas("Atlases/StomachAtlas2");
        }
        else if (stage_name.Equals("lung"))
        {
            Futile.atlasManager.LoadAtlas("Atlases/LungBackground1");
            Futile.atlasManager.LoadAtlas("Atlases/LungBackground2");
            Futile.atlasManager.LoadAtlas("Atlases/LungBackground3");
            Futile.atlasManager.LoadAtlas("Atlases/LungBackground4");
            Futile.atlasManager.LoadAtlas("Atlases/LungBackground5");

            Futile.atlasManager.LoadAtlas("Atlases/lung_layers");
            Futile.atlasManager.LoadAtlas("Atlases/DustRear");
            Futile.atlasManager.LoadAtlas("Atlases/DustMid");
            Futile.atlasManager.LoadAtlas("Atlases/DustFore");
        }
        else
        {
            Futile.atlasManager.LoadAtlas("Atlases/BrainAtlas");
            Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_80_animation");
            Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_60_animation");
            Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_40_animation");
            Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_80_animation");
            Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_60_animation");
            Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_40_animation");
        }

        Futile.atlasManager.LoadAtlas("Atlases/MenuWords");
        Futile.atlasManager.LoadAtlas("Atlases/VictoryDefeatAtlas");

        FSoundManager.PreloadSound("player_hit");
        FSoundManager.PreloadSound("bacteria_pop");
        FSoundManager.PreloadSound("enemy_hit");

        Futile.atlasManager.LogAllElementNames();

        stage_ = Futile.stage;

        camera_ = new FCamObject();
        stage_.AddChild(camera_);

        //Rect worldBounds = stage.worldBounds;
        //camera_.setWorldBounds (worldBounds);
        //camera_.setBounds(stage.cameraBounds);

        gamePage = new CombatPage();
        gamePage.Start();
        camera_.AddChild(gamePage);
    }
    void Start()
    {
        instance = this;

        FutileParams fparams = new FutileParams(true, true, false, false);

        fparams.AddResolutionLevel(1280.0f, 1.0f, 1.0f, "");
        fparams.origin = new Vector2(0.5f, 0.5f);

        Futile.instance.Init(fparams);

        Futile.atlasManager.LoadAtlas("Atlases/HuroCombatAtlas");
        Futile.atlasManager.LoadAtlas("Atlases/EnemyCombatAtlas");

        if(stage_name.Equals("stomach"))
        {
            Futile.atlasManager.LoadAtlas("Atlases/StomachAtlas1");
            Futile.atlasManager.LoadAtlas("Atlases/StomachAtlas2");
        }
        else if(stage_name.Equals("lung"))
        {
            Futile.atlasManager.LoadAtlas("Atlases/LungBackground1");
            Futile.atlasManager.LoadAtlas("Atlases/LungBackground2");
            Futile.atlasManager.LoadAtlas("Atlases/LungBackground3");
            Futile.atlasManager.LoadAtlas("Atlases/LungBackground4");
            Futile.atlasManager.LoadAtlas("Atlases/LungBackground5");

            Futile.atlasManager.LoadAtlas("Atlases/lung_layers");
            Futile.atlasManager.LoadAtlas("Atlases/DustRear");
            Futile.atlasManager.LoadAtlas("Atlases/DustMid");
            Futile.atlasManager.LoadAtlas("Atlases/DustFore");

        }
        else
        {
            Futile.atlasManager.LoadAtlas("Atlases/BrainAtlas");
            Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_80_animation");
            Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_60_animation");
            Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_40_animation");
            Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_80_animation");
            Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_60_animation");
            Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_40_animation");
        }

        Futile.atlasManager.LoadAtlas("Atlases/MenuWords");
        Futile.atlasManager.LoadAtlas ("Atlases/VictoryDefeatAtlas");

        FSoundManager.PreloadSound("player_hit");
        FSoundManager.PreloadSound("bacteria_pop");
        FSoundManager.PreloadSound("enemy_hit");

        Futile.atlasManager.LogAllElementNames();

        stage_ = Futile.stage;

        camera_ = new FCamObject();
        stage_.AddChild(camera_);

        //Rect worldBounds = stage.worldBounds;
        //camera_.setWorldBounds (worldBounds);
        //camera_.setBounds(stage.cameraBounds);

        gamePage = new CombatPage();
        gamePage.Start();
        camera_.AddChild(gamePage);
    }