Пример #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 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;
        }
    }
Пример #3
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;
            }
        }
    }
Пример #4
0
    void UpdateMovement()
    {
        Vector3 posTargetV3 = new Vector3(posTarget[0], posTarget[1], posTarget[2]);

        pos = Vector3.Lerp(pos, posTargetV3, (Time.deltaTime * moveSpeed[0]));

        rot[0] = Quaternion.Slerp(rot[0], rot[1], (Time.deltaTime * moveSpeed[0]));
        fov[0] = Mathf.Lerp(fov[0], fov[1], (Time.deltaTime * moveSpeed[0]));


        GameObject[] text = GameObject.FindGameObjectsWithTag("Text");

        foreach (GameObject t in text)
        {
            SCR_text ts = t.GetComponent <SCR_text>();

            if (ts.worldLinked)
            {
                ts.UpdatePos();
            }
        }
    }
Пример #5
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);
                        }
                    }
                }
            }
        }
    }
Пример #6
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));
        }
    }
Пример #7
0
    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;
        }
    }