Esempio n. 1
0
    void Awake()
    {
        if (mInstance != null)
        {
            throw new UnityException("Error in CGame(). You are not allowed to instantiate it more than once.");
        }

        //CGameConstants.HIGH_SCORE =int.Parse( System.IO.File.ReadAllText("score.txt"));


        mInstance = this;

        CMouse.init();
        CurrentStageData.init();
        LevelsInfo.init();
        imgBackground = new CSprite();

        //Handheld.PlayFullScreenMovie("IntroGame2.mp4", Color.black, FullScreenMovieControlMode.CancelOnInput);
        setState(new CMenuState());

        mSpriteManager = new CSpriteManager();


        //setImage("Sprites/Placeholders_Prototype/level_Background");
    }
Esempio n. 2
0
    //    private static AudioManager audioMgr;
    //    public static AudioManager Audio{
    //        get { return audioMgr; }
    //    }
    void Awake()
    {
        gameMgr = GetComponent<CGameManager>();
        enemyMgr = GetComponent<CEnemyManager>();
        spriteMgr = GetComponent<CSpriteManager>();
        //		audioMgr = GetComponent<AudioManager>();

        DontDestroyOnLoad(gameObject);
    }
Esempio n. 3
0
 override public void render()
 {
     base.render();
     CSpriteManager.inst().render();
     storyBtn.render();
     endlessBtn.render();
     exit.render();
     creditsBtn.render();
 }
Esempio n. 4
0
    // ----------

    public void DestroyMe()
    {
        this.marked = true;

        CSpriteManager cs = MonoBehaviour.FindObjectOfType(typeof(CSpriteManager)) as CSpriteManager;

        this.renderer.material = cs.SwitchToExplosion(this.enemyType);
        Invoke("Disappear", dissapearDelay);
    }
 override public void render()
 {
     base.render();
     CSpriteManager.inst().render();
     backBtn.render();
     dinoBtn.render();
     kongBtn.render();
     krakenBtn.render();
 }
Esempio n. 6
0
//	private static AudioManager audioMgr;
//	public static AudioManager Audio{
//		get { return audioMgr; }
//	}

    void Awake()
    {
        gameMgr   = GetComponent <CGameManager>();
        enemyMgr  = GetComponent <CEnemyManager>();
        spriteMgr = GetComponent <CSpriteManager>();
//		audioMgr = GetComponent<AudioManager>();

        DontDestroyOnLoad(gameObject);
    }
Esempio n. 7
0
 private void registerSingleton()
 {
     if (mInst == null)
     {
         mInst = this;
     }
     else
     {
         throw new UnityException("ERROR: Cannot create another instance of singleton class CEnemyManager.");
     }
 }
Esempio n. 8
0
    override public void update()
    {
        base.update();
        CMouse.update();
        storyBtn.update();
        endlessBtn.update();
        exit.update();
        creditsBtn.update();
        if (creditsClick())
        {
            CGame.inst().setState(new CCreditsState());
        }
        if (storyClick())
        {
            SoundList.instance.playNewGame();
            storyBtn.setImage(Resources.Load <Sprite>("Sprites/Buttons/Button_Story_Mode_p"));
            buttonClicked = 1;

            return;
        }
        else
        if (endlessClick())
        {
            endlessBtn.setImage(Resources.Load <Sprite>("Sprites/Buttons/Button_Endless_p"));
            buttonClicked = 2;

            return;
        }
        else if (exitClick())
        {
            exit.setImage(Resources.Load <Sprite>("Sprites/Buttons/Button_Exit_p"));
            buttonClicked = 3;
        }
        CSpriteManager.inst().update();
        switch (buttonClicked)
        {
        case 0:
            break;

        case 1:
            CGame.inst().setState(new CLevelState(1));
            break;

        case 2:
            CGame.inst().setState(new CKaijuSelectionState());
            break;

        case 3:
            Application.Quit();
            break;
        }
    }
Esempio n. 9
0
 public void deleteMatches()
 {
     for (int i = matrixBoard.Count() - 1; i >= 0; i--)
     {
         for (int j = 0; j < matrixBoard[0].Count(); j++)
         {
             if (matrixBoard[i][j].food.matched == true)
             {
                 MatchAnim matched = new MatchAnim(matrixBoard[i][j].food.Type, matrixBoard[i][j].background.getX(), matrixBoard[i][j].background.getY());
                 CSpriteManager.inst().add(matched);
                 matrixBoard[i][j].clearFood();
             }
         }
     }
 }
Esempio n. 10
0
    public void update()
    {
        button01.update();
        button02.update();
        barFill.update();
        emptyBar.update();
        if (scaleCounter != 0 & scale <= 100)
        {
            float aux = scaleCounter / 10;
            scale        += aux;
            scaleCounter -= aux;
            barFill.setScaleY(scale);
            if (scale >= 100)
            {
                scale        = 100;
                scaleCounter = 0;
                button01.setImage(Resources.Load <Sprite>("Sprites/SkillBar/Button-Skill1-Active"));
                button02.setImage(Resources.Load <Sprite>("Sprites/SkillBar/Button-Skill2-Active0" + button2Type.ToString()));
                currentState = STATE_FULL;
            }
        }

        if (currentState == STATE_FULL)
        {
            if (skill1Click() && CurrentStageData.currentBoard.current_state != 0)
            {
                CurrentStageData.currentKaiju.firstPower();
                scaleCounter = -100;
                button01.setImage(Resources.Load <Sprite>("Sprites/SkillBar/Button-Skill1-Unable"));
                button02.setImage(Resources.Load <Sprite>("Sprites/SkillBar/Button-Skill2-Unable0" + button2Type.ToString()));
                currentState = STATE_NORMAL;
            }
            else if (skill2Click() && CurrentStageData.currentBoard.current_state != 0)
            {
                CAnimatedSprite skillAnim = new CAnimatedSprite();
                Skill2Animation auxSkill  = new Skill2Animation(button2Type);
                CSpriteManager.inst().add(auxSkill);

                scaleCounter = -100;
                button01.setImage(Resources.Load <Sprite>("Sprites/SkillBar/Button-Skill1-Unable"));
                button02.setImage(Resources.Load <Sprite>("Sprites/SkillBar/Button-Skill2-Unable0" + button2Type.ToString()));
                currentState = STATE_NORMAL;
            }
        }
    }
Esempio n. 11
0
        //* ────________________________________*
        //* methods ───────────────────────────────-*

        //* -----------------------------------------------------------------------*
        /// <summary>初期化処理を実行します。</summary>
        protected override void initialize()
        {
            CGame game = CGame.instance;
            GraphicsDeviceManager gdm = game.graphicDeviceManager;

            game.IsMouseVisible  = true;
            game.IsFixedTimeStep = false;
            gdm.IsFullScreen     = false;
            gdm.SynchronizeWithVerticalRetrace = true;
            gdm.PreferMultiSampling            = false;
            gdm.ApplyChanges();
            CSpriteManager sprite = new CSpriteManager();

            sprite.spriteBatch = new SpriteBatch(gdm.GraphicsDevice);
            sprite.resolution  = new CResolutionLetterBox(EResolution.DCGA, EResolution.VGA, false);
            CGame.sprite       = sprite;
            initializeViewport();
            game.GraphicsDevice.RenderState.PointSpriteEnable        = true;
            game.GraphicsDevice.RenderState.MultiSampleAntiAlias     = false;
            game.GraphicsDevice.SamplerStates[0].MagFilter           = TextureFilter.None;
            new CDrawableGameComponent(game, sprite, true).DrawOrder = 0;
        }
Esempio n. 12
0
        //* ────________________________________*
        //* methods ───────────────────────────────-*

        //* -----------------------------------------------------------------------*
        /// <summary>初期化処理を実行します。</summary>
        protected override void initialize()
        {
            CGame          game   = CGame.instance;
            CSpriteManager sprite = CGame.sprite;

            CONTENT.setContentManager(game.Content);
            SpriteFont font = CONTENT.texFont98;

            for (int i = hudStates.Length; --i >= 0;)
            {
                CFont hud = new CFont(font);
                hud.nextState = hudStates[i];
                hud.pos       = pos[i];
                hud.sprite    = sprite;
                hud.layer     = 0;
                hud.commitNextState(true);
                hud.alignHorizontal = EAlign.LeftTop;
                hud.alignVertical   = EAlign.LeftTop;
                new CDrawableGameComponent(game, hud, true);
            }
            new CDrawableGameComponent(game, new CEntity(CStateFPSCalculator.instance), true);
            CGuideWrapper.instance.NotificationPosition = NotificationPosition.Center;
        }
    override public void update()
    {
        base.update();
        CMouse.update();
        backBtn.update();
        dinoBtn.update();
        kongBtn.update();
        krakenBtn.update();

        if (backClick())
        {
            SoundList.instance.playMenuMusic();
            CGame.inst().setState(new CMenuState());
            return;
        }

        switch (selected)
        {
        case 0:
            if (dinoClick())
            {
                kongBtn.leave();
                krakenBtn.leave();
                selected = 1;
                SoundList.instance.playNewGame2();
                return;
            }
            else
            if (kongClick())
            {
                dinoBtn.leave();
                krakenBtn.leave();
                SoundList.instance.playNewGame2();
                selected = 2;
                return;
            }
            else if (krakenClick())
            {
                kongBtn.leave();
                dinoBtn.leave();
                SoundList.instance.playNewGame2();
                selected = 3;
                return;
            }
            break;

        case 1:
            if (kongBtn.currentState == 1 & krakenBtn.currentState == 1)
            {
                CInfo aux1 = new CInfo(1, 1, 50, 70, CGameConstants.HIGH_SCORE, 0, 0, 0);
                CGame.inst().setState(new CSurvivalState(aux1));
            }
            break;

        case 2:
            if (dinoBtn.currentState == 1 & krakenBtn.currentState == 1)
            {
                CInfo aux1 = new CInfo(2, 1, 50, 70, CGameConstants.HIGH_SCORE, 0, 0, 0);
                CGame.inst().setState(new CSurvivalState(aux1));
            }
            break;

        case 3:
            if (dinoBtn.currentState == 1 & kongBtn.currentState == 1)
            {
                CInfo aux1 = new CInfo(3, 1, 50, 70, CGameConstants.HIGH_SCORE, 0, 0, 0);
                CGame.inst().setState(new CSurvivalState(aux1));
            }
            break;
        }


        CSpriteManager.inst().update();
    }
Esempio n. 14
0
 override public void destroy()
 {
     base.destroy();
     mInst = null;
 }
Esempio n. 15
0
    public void countScore()
    {
        float totalScore = 0;
        int   lastType;

        //recorrida por fila
        for (int i = 0; i < matrixBoard.Count(); i++)
        {
            for (int j = 0; j < matrixBoard[i].Count(); j++)
            {
                int count = 1;
                lastType = -1;
                if (matrixBoard[i][j].food.matched & j + 1 < matrixBoard[i].Count())
                {
                    while (matrixBoard[i][j + 1].food.Type == matrixBoard[i][j].food.Type)
                    {
                        lastType = matrixBoard[i][j].food.Type;
                        count++;
                        j++;
                        if (j >= matrixBoard[i].Count() - 1)
                        {
                            break;
                        }
                    }
                    if (count >= 3)
                    {
                        float auxScore   = 3;
                        float multiplier = 1;
                        if (lastType == 3)
                        {
                            auxScore = 2;
                        }
                        if (lastType == CurrentStageData.currentKaiju.prefferedFood)
                        {
                            auxScore = 5;
                            CurrentStageData.currentKaiju.setState(1);
                            SoundList.instance.playComer();
                        }
                        else if (lastType == 4)
                        {
                            SoundList.instance.playBomb();
                            auxScore = -4;
                        }
                        switch (count)
                        {
                        case 3:
                            multiplier = 1;
                            break;

                        case 4:
                            multiplier = 1.5f;
                            break;

                        case 5:
                            multiplier = 2.0f;
                            break;

                        case 6:
                            multiplier = 2.5f;
                            break;
                        }
                        auxScore    = auxScore * multiplier;
                        totalScore += auxScore;
                    }
                    count = 1;
                }
            }
        }
        //recorrida por columna
        for (int j = 0; j < matrixBoard.Count(); j++)
        {
            for (int i = 0; i < matrixBoard.Count(); i++)
            {
                int count = 1;
                lastType = -1;
                if (matrixBoard[i][j].food.matched & i + 1 < matrixBoard.Count())
                {
                    while (matrixBoard[i + 1][j].food.Type == matrixBoard[i][j].food.Type)
                    {
                        lastType = matrixBoard[i][j].food.Type;
                        count++;
                        i++;
                        if (i >= matrixBoard.Count() - 1)
                        {
                            break;
                        }
                    }
                    if (count >= 3)
                    {
                        float auxScore   = 3;
                        float multiplier = 1;
                        if (lastType == 3)
                        {
                            auxScore = 2;
                        }
                        if (lastType == CurrentStageData.currentKaiju.prefferedFood)
                        {
                            auxScore = 5;
                            CurrentStageData.currentKaiju.setState(1);
                            SoundList.instance.playComer();
                        }
                        else if (lastType == 4)
                        {
                            SoundList.instance.playBomb();
                            auxScore = -4;
                        }
                        switch (count)
                        {
                        case 3:
                            multiplier = 1;
                            break;

                        case 4:
                            multiplier = 1.5f;
                            break;

                        case 5:
                            multiplier = 2.0f;
                            break;

                        case 6:
                            multiplier = 2.5f;
                            break;
                        }
                        auxScore    = auxScore * multiplier;
                        totalScore += auxScore;
                    }
                    count = 1;
                }
            }
        }
        if (totalScore < 0)
        {
            CSpriteManager.inst().add(new ArrowAnimation(4));
        }
        else if (totalScore < 3)
        {
            CSpriteManager.inst().add(new ArrowAnimation(3));
        }
        else if (totalScore < 5)
        {
            CSpriteManager.inst().add(new ArrowAnimation(3));
            CSpriteManager.inst().add(new ArrowAnimation(3, 1));
        }
        else
        {
            CSpriteManager.inst().add(new ArrowAnimation(2));
        }

        if (totalScore > 9)
        {
            CSpriteManager.inst().add(new ArrowAnimation(2));
            CSpriteManager.inst().add(new ArrowAnimation(2, 1));
        }
        if (totalScore > 15)
        {
            CSpriteManager.inst().add(new ArrowAnimation(2, 2));
        }

        if (totalScore > 0)
        {
            SoundList.instance.playMatch();
        }
        CurrentStageData.addScore(totalScore);
    }