Esempio n. 1
0
 public static FCamObject getCameraInstance()
 {
     if (camera == null)
     {
         camera = new FCamObject();
         camera.shakeHUD = false;
     }
     return camera;
 }
    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);
    }
Esempio n. 4
0
    override public void HandleRemovedFromStage()
    {
        _cam = null;

        base.HandleRemovedFromStage();
    }
Esempio n. 5
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);
        }
	override public void HandleRemovedFromStage()
	{
		_cam = null;
		
		base.HandleRemovedFromStage();
	}
Esempio n. 7
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);
    }
    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);
    }