예제 #1
0
    public void Collect()
    {
        SCR_collectableSpawner.collectableTotal--;
        SCR_collectableSpawner.spawnPointOccupied[spawnSlot] = 0;

        isActive    = false;
        fadeCounter = 1.5f;

        if (collectEffectObj)
        {
            GameObject collectEffectInst = Instantiate(collectEffectObj, transform.position, Quaternion.identity) as GameObject;
        }

        if (SND_collect)
        {
            SND_collect.PlaySound();

            if (collectPoints == true)
            {
                SCR_main.score += points;

                if (SCR_main.pOn)
                {
                    SCR_text p = SCR_gui.CreateText("PopUpPoints", Vector3.zero);
                    p.UpdateText(points.ToString());
                    p.SetWorldPos(transform.position, 1f);
                    p.SetFadeSpeed(0.55f, 0.2f);
                }
            }
        }

        flashOn = true;
        DisplayFlash();
    }
예제 #2
0
    void Awake()
    {
        SCR_gui.CreateScreenCover(0);

        if (skyBoxMaterial)
        {
            RenderSettings.skybox = skyBoxMaterial;
        }

        GameObject m    = GameObject.Find("MAIN");
        SCR_main   main = m.GetComponent <SCR_main>();

        GameObject spawnPointPlayer = GameObject.Find("SpawnPointPlayer");
        Vector3    playerPos        = new Vector3(spawnPointPlayer.transform.position.x, 0f, spawnPointPlayer.transform.position.z);

        if (main.playerSelect == true)
        {
            GameObject playerInst = Instantiate(main.playerObj1, playerPos, Quaternion.identity) as GameObject;
            Destroy(spawnPointPlayer);
        }
        else if (main.playerSelect == false)
        {
            GameObject playerInst = Instantiate(main.playerObj2, playerPos, Quaternion.identity) as GameObject;
            Destroy(spawnPointPlayer);
        }

        if (gameCompleteMusic && SCR_main.hMusic)
        {
            m.GetComponent <SCR_music>().PlayMusic(gameCompleteMusic);
        }
    }
예제 #3
0
파일: SCR_stage.cs 프로젝트: balatimuz/cos
    void ShowHUD(bool com)
    {
        if (com)
        {
            SCR_gui.CreateText("ScoreText", Vector3.zero);
            scoreObj = SCR_gui.CreateText("ScoreNumber", Vector3.zero);

            if (stageTimer == true)
            {
                SCR_gui.CreateText("TimerText", Vector3.zero);
                SCR_gui.CreateText("TimerNumber", Vector3.zero);
                startTimer = true;
                GameObject t = GameObject.Find("TimerNumber");
                guitimer = t.GetComponent <GUIText>();
                StartCoroutine(timerUpdate());
            }

            DisplayScore();
        }
        else
        {
            SCR_gui.RemoveText("ScoreText");
            SCR_gui.RemoveText("ScoreNumber");
            SCR_gui.CreateText("TimerText", Vector3.zero);
            SCR_gui.CreateText("TimerNumber", Vector3.zero);
            startTimer = false;
        }
    }
예제 #4
0
 public void FadeOut()
 {
     if (hMusic)
     {
         music.FadeOut(0);
     }
     screenFade = SCR_gui.CreateScreenCover(1);
 }
예제 #5
0
파일: SCR_stage.cs 프로젝트: balatimuz/cos
    public void PauseEvent(bool com)
    {
        if (com != paused)
        {
            paused  = com;
            pauseCD = 1f;

            if (paused)
            {
                if (SCR_main.hCursor)
                {
                    Cursor.visible = true;
                }

                pauseCover = SCR_gui.CreateScreenCover(2);
                SCR_gui.CreateIcon("Paused", Vector3.zero);
                optionPos = new Vector2(0.5f, 0.55f);

                SCR_gui.CreateOption("PausedResume", optionPos);
                optionPos += SCR_gui.optionSpacing;
                SCR_gui.CreateOption("ChangeSoundFX", optionPos);
                optionPos += SCR_gui.optionSpacing;

                if (SCR_main.hMusic)
                {
                    SCR_gui.CreateOption("ChangeMusic", optionPos);
                    optionPos += SCR_gui.optionSpacing;
                }

                SCR_gui.CreateOption("PausedExit", optionPos);

                Time.timeScale = 0f;
            }
            else
            {
                if (SCR_main.hCursor)
                {
                    Cursor.visible = false;
                }

                if (pauseCover)
                {
                    pauseCover.FadeOut();
                }
                SCR_gui.RemoveIcon("Paused");
                SCR_input.OptionCycle(3);

                Time.timeScale = 1f;
            }
        }
    }
예제 #6
0
    void Awake()
    {
        SCR_gui.CreateScreenCover(0);

        if (menuMusic && SCR_main.hMusic)
        {
            GameObject.Find("MAIN").GetComponent <SCR_music>().PlayMusic(menuMusic);
        }

        if (skyBoxMaterial)
        {
            RenderSettings.skybox = skyBoxMaterial;
        }
    }
예제 #7
0
    public void FinishMenu()
    {
        SCR_input.rightClickAction = -1;

        SCR_gui.RemoveIcon("Title");
        SCR_gui.RemoveIcon("Options");
        SCR_gui.RemoveIcon("WipeData");
        SCR_gui.RemoveIcon("Controls");
        SCR_gui.RemoveIcon("HighScores");

        SCR_gui.RemoveText("HighScoreRank");
        SCR_gui.RemoveText("HighScoreNumber");

        if (controlTypeDescription)
        {
            controlTypeDescription.Kill();
        }
    }
예제 #8
0
    void UpdateState()
    {
        stateCounter += Time.deltaTime;

        if (state == 10)
        {
            if (stateCounter >= 0.4f)
            {
                SCR_gui.CreateIcon("GameComplete", Vector3.zero);
                StateNext();
            }
        }

        if (state == 11)
        {
            if (stateCounter >= 0.2f)
            {
                SCR_gui.CreateText("GameComplete", Vector3.zero);
                StateNext();
            }
        }

        if (state == 12)
        {
            if (stateCounter >= 0.4f)
            {
                SCR_gui.CreateText("GameCompleteScoreText", Vector3.zero);
                SCR_text score = SCR_gui.CreateText("GameCompleteScoreNumber", Vector3.zero);
                score.UpdateText(SCR_main.score.ToString());
                StateNext();
            }
        }

        if (state == 13)
        {
            if (stateCounter >= 0.4f)
            {
                SCR_gui.CreateOption("GameCompleteReturn", new Vector2(0.5f, 0.15f));
                state = 0;
            }
        }
    }
예제 #9
0
    void Awake()
    {
        SCR_gui.CreateScreenCover(0);
        SCR_gui.CreateText("PlayerSelect", Vector3.zero);

        if (skyBoxMaterial)
        {
            RenderSettings.skybox = skyBoxMaterial;
        }

        GameObject m    = GameObject.Find("MAIN");
        SCR_main   main = m.GetComponent <SCR_main>();

        if (playerSelectMusic && SCR_main.hMusic)
        {
            m.GetComponent <SCR_music>().PlayMusic(playerSelectMusic);
        }

        SCR_main.level = 1;
    }
예제 #10
0
파일: SCR_stage.cs 프로젝트: balatimuz/cos
    void CreateCountDown(int com)
    {
        string iconName = "CountDown";

        if (com == 3)
        {
            iconName = "Start";
        }

        SCR_icon countDownInst = SCR_gui.CreateIcon(iconName, Vector3.zero);

        if (com < 3)
        {
            string    countDownStr      = "Textures/Gui/_Icon/Text_";
            Texture[] countDownTexArray = new Texture[3] {
                Resources.Load((countDownStr + "3"), typeof(Texture)) as Texture,
                Resources.Load((countDownStr + "2"), typeof(Texture)) as Texture,
                Resources.Load((countDownStr + "1"), typeof(Texture)) as Texture
            };

            countDownInst.GetComponent <GUITexture>().texture = countDownTexArray[com];
        }
    }
예제 #11
0
    void UpdateAction()
    {
        character.SetRotAngle(currentTargetEnemy.transform.position);

        actionCounter += Time.deltaTime;

        if (action == 0 || action == 1)
        {
            if (action == 0)
            {
                character.speed[1] = (character.dir * character.runSpeed);

                if (actionCounter >= actionLimit)
                {
                    SetAction(1);
                }
            }
            else
            {
                if (actionCounter >= actionLimit)
                {
                    SetAction(0);
                }
            }
            character.SetRotTarget();

            CheckPlayerDistance(1);
        }
        else
        {
            if (action == 2)
            {
                //ready to attack
                character.SetRotTarget();

                if (actionCounter >= actionLimit)
                {
                    SetAction(3);
                }

                CheckPlayerDistance(2);
            }
            else
            {
                if (action == 10)
                {
                    //dying

                    if (actionCounter >= 1.25f)
                    {
                        if (SCR_main.pOn)
                        {
                            SCR_text p = SCR_gui.CreateText("PopUpPoints", Vector3.zero);
                            p.UpdateText(points.ToString());
                            p.SetWorldPos(transform.position, 1f);
                            p.SetFadeSpeed(0.55f, 0.2f);
                        }

                        SetAction(11);
                        character.StartFlash(1, 1000);
                        GetComponent <BoxCollider>().isTrigger = true;
                    }
                }
                else
                {
                    if (action == 11)
                    {
                        //vanishing
                        if (actionCounter >= 0.55f)
                        {
                            SCR_main.DestroyObj(gameObject);
                        }
                    }
                }
            }
        }
    }
예제 #12
0
    void OpenMenu(int com)
    {
        Vector2 optionPos;

        if (com == 0)
        {
            //TITLE
            SCR_input.rightClickAction = -1;

            SCR_gui.CreateIcon("Title", Vector3.zero);

            optionPos = new Vector2(0.5f, 0.6f);
            SCR_gui.CreateOption("StartGame", optionPos);
            optionPos += SCR_gui.optionSpacing;

            if (SCR_main.hsOn)
            {
                SCR_gui.CreateOption("HighScores", optionPos);
                optionPos += SCR_gui.optionSpacing;
            }

            SCR_gui.CreateOption("Options", optionPos);

            SCR_gui.CreateIcon("Controls", Vector3.zero);
        }

        if (com == 1)
        {
            //OPTIONS
            SCR_input.rightClickAction = 0;

            SCR_gui.CreateIcon("Options", Vector3.zero);
            optionPos = new Vector2(0.5f, 0.575f);

            SCR_gui.CreateOption("ChangeSoundFX", optionPos);
            optionPos += SCR_gui.optionSpacing;

            if (SCR_main.hMusic)
            {
                SCR_gui.CreateOption("ChangeMusic", optionPos);
                optionPos += SCR_gui.optionSpacing;
            }
            SCR_gui.CreateOption("WipeData", optionPos);
            optionPos += SCR_gui.optionSpacing;
            SCR_gui.CreateOption("OptionsReturn", optionPos);
        }

        if (com == 2)
        {
            //WIPE DATA

            SCR_input.rightClickAction = 2;

            SCR_gui.CreateIcon("WipeData", Vector3.zero);
            optionPos = new Vector2(0.5f, 0.5f);

            SCR_gui.CreateOption("WipeDataYes", optionPos);
            optionPos += SCR_gui.optionSpacing;
            SCR_gui.CreateOption("WipeDataNo", optionPos);
        }


        if (com == 3)
        {
            //HIGH SCORES

            SCR_input.rightClickAction = 0;

            SCR_gui.CreateIcon("HighScores", Vector3.zero);

            float highScoreY       = 0.7f;
            float highScoreSpacing = -0.045f;
            float rankX            = 0.475f;
            float scoreX           = 0.525f;

            for (int i = 0; i < SCR_main.highScore.Count; i++)
            {
                SCR_text tRank = SCR_gui.CreateText("HighScoreRank", new Vector3(rankX, highScoreY, 0f));
                tRank.UpdateText((i + 1).ToString());

                SCR_text tScore = SCR_gui.CreateText("HighScoreNumber", new Vector3(scoreX, highScoreY, 0f));
                tScore.UpdateText(SCR_main.highScore[i].ToString());

                highScoreY += highScoreSpacing;
            }

            SCR_gui.CreateOption("HighScoresReturn", new Vector2(0.5f, 0.15f));
        }
    }
예제 #13
0
파일: SCR_stage.cs 프로젝트: balatimuz/cos
    void Awake()
    {
        GameObject m = GameObject.Find("MAIN");

        main  = m.GetComponent <SCR_main>();
        music = m.GetComponent <SCR_music>();

        if (stageMusic && SCR_main.hMusic)
        {
            music.PlayMusic(stageMusic);
        }

        SCR_input.playerControlActive = false;

        pauseAllowed      = false;
        paused            = false;
        SCR_main.scoreRec = SCR_main.score;
        scoreRec          = SCR_main.score;

        GameObject camInst = Instantiate(stageCamera, Vector3.zero, Quaternion.identity) as GameObject;

        GameObject spawnPointPlayer = GameObject.Find("SpawnPointPlayer");
        Vector3    playerPos        = new Vector3(spawnPointPlayer.transform.position.x, 0f, spawnPointPlayer.transform.position.z);

        if (main.playerSelect == true)
        {
            GameObject playerInst = Instantiate(main.playerObj1, playerPos, Quaternion.identity) as GameObject;
            Destroy(spawnPointPlayer);
            player = playerInst.GetComponent <SCR_character>();

            SetupStageSize();

            cam = camInst.GetComponent <SCR_camStage>();
            cam.SetTarget(playerInst.transform);
            cam.InitiateStage(0);
        }
        else if (main.playerSelect == false)
        {
            GameObject playerInst = Instantiate(main.playerObj2, playerPos, Quaternion.identity) as GameObject;
            Destroy(spawnPointPlayer);
            player = playerInst.GetComponent <SCR_character>();

            SetupStageSize();

            cam = camInst.GetComponent <SCR_camStage>();
            cam.SetTarget(playerInst.transform);
            cam.InitiateStage(0);
        }


        if (skyBoxMaterial)
        {
            RenderSettings.skybox = skyBoxMaterial;
        }

        if (SCR_main.hCursor)
        {
            Cursor.visible = false;
        }

        SetState(10);

        SCR_gui.CreateScreenCover(0);
    }
예제 #14
0
파일: SCR_stage.cs 프로젝트: balatimuz/cos
    void UpdateState()
    {
        stateCounter += Time.deltaTime;

        //INTRO
        if (state == 10)
        {
            if (stateCounter >= 0.5f)
            {
                CreateCountDown(0);
                StateNext();
            }
        }
        if (state == 11)
        {
            if (stateCounter >= 1f)
            {
                CreateCountDown(1);
                StateNext();
            }
        }
        if (state == 12)
        {
            if (stateCounter >= 1f)
            {
                cam.InitiateStage(1);
                CreateCountDown(2);
                StateNext();
            }
        }
        if (state == 13)
        {
            if (stateCounter >= 1f)
            {
                CreateCountDown(3);
                pauseAllowed = true;
                SCR_input.playerControlActive = true;
                SCR_enemySpawner.spawnOn      = true;
                player.GetComponent <SCR_characterControl>().ReticleOn(true);

                StateNext();
            }
        }
        if (state == 14)
        {
            if (stateCounter >= 1f)
            {
                ShowHUD(true);
                SetState(0);
            }
        }

        //FAIL
        if (state == 20)
        {
            if (stateCounter >= 0.6f)
            {
                SCR_gui.CreateIcon("GameOver", Vector3.zero);

                if (SCR_main.hMusic)
                {
                    music.FadeOut(1);
                }

                StateNext();
            }
        }

        if (state == 21)
        {
            if (stateCounter >= 0.3f)
            {
                if (SCR_main.hCursor)
                {
                    Cursor.visible = true;
                }

                optionPos = stageFinishOptionPos;
                SCR_gui.CreateOption("StageFailRetry", optionPos);
                optionPos += SCR_gui.optionSpacing;
                SCR_gui.CreateOption("StageFailExit", optionPos);
                SetState(0);
            }
        }


        //SUCCESS
        if (state == 30)
        {
            if (stateCounter >= 1f)
            {
                SCR_input.playerControlActive = false;
                player.GetComponent <SCR_characterControl>().ReticleOn(false);

                player.AttackCancel();
                player.speed[1] = Vector3.zero;
                player.PlayAnim(0);

                if (SCR_main.hMusic)
                {
                    music.FadeOut(1);
                }

                StateNext();
            }
        }

        if (state == 31)
        {
            if (stateCounter >= 0.3f)
            {
                startTimer = false;
                SCR_gui.CreateIcon("StageComplete", Vector3.zero);
                StateNext();
            }
        }

        if (state == 32)
        {
            if (stateCounter >= 0.2f)
            {
                if (SCR_main.hCursor)
                {
                    Cursor.visible = true;
                }

                optionPos = stageFinishOptionPos;
                SCR_gui.CreateOption("StageCompleteContinue", optionPos);
                optionPos += SCR_gui.optionSpacing;
                SCR_gui.CreateOption("StageCompleteExit", optionPos);
                SetState(0);
            }
        }
    }