예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (player != null)
     {
         for (int i = 0; i < checkpoints.Count; i++)
         {
             float dist = (player.transform.position - ((GameObject)checkpoints [i]).transform.position).sqrMagnitude;
             if (dist < 7 && player.transform.position.x > ((GameObject)checkpoints [i]).transform.position.x)
             {
                 if (((GameObject)checkpoints [i]).GetComponent <CheckPointScript> ().goal)
                 {
                     player.GetComponent <PlayerController>().completeLevel();
                     LevelNumberHolder.setHighestLevel();
                 }
                 else
                 {
                     if (!((GameObject)checkpoints [i]).GetComponent <CheckPointScript> ().triggered)
                     {
                         ((GameObject)checkpoints [i]).GetComponent <CheckPointScript> ().triggered = true;
                         if (!player.GetComponent <PlayerController> ().startGame)
                         {
                             var partEfIn = (Instantiate(checkPointEffect, ((GameObject)checkpoints [i]).transform.position, Quaternion.identity) as GameObject);
                             Destroy(partEfIn, 1.0f);
                             audio.PlayOneShot(hitCheckpointSound);
                         }
                     }
                     //((GameObject)checkpoints [i]).renderer.material.color = new Color (0.5f, 1, 0);
                     PlayerController.startPosition = new Vector3(player.transform.position.x, player.transform.position.y, 0);
                     PlayerController.hasCheck      = true;
                 }
             }
         }
     }
 }
 void Awake()
 {
     if (instance != null && instance != this) {
         Destroy(this.gameObject);
         return;
     } else {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
예제 #3
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
예제 #4
0
    void OnGUI()
    {
        GUI.skin.button.normal.background = buttonImage;
        GUI.skin.button.hover.background  = buttonImage;
        GUI.skin.button.active.background = buttonImage;
        GUI.skin.button.font = Resources.Load <Font>("UIFontRingBearer");

        if (showDebugButtons)
        {
            if (customButton(10, 3, "DebugUnlock"))
            {
                LevelNumberHolder.setLevel(1000);
            }
            if (customButton(11, 3, "DebugLock"))
            {
                LevelNumberHolder.setLevel(0);
            }
        }



        PlayerController.hasCheck = false;
        //if (GUI.Button (new Rect (10, 10, buttonWidth/2, buttonHeight), "Back"))
        {
            //Go to the main menu
        }

        /*
         * if (checkButton(1, "Tutorial: New Heights"))
         * {
         *      ScreenTransitioner.Instance.TransitionTo( "UpTutorial" );
         * }
         *
         * int place = 2;
         *
         * lockButtonHelper( place++, "Tutorial: Dashing along", "TalansLevel" );
         * lockButtonHelper( place++, "Tutorial: Up and up", "JumpAndDownPractice_1" );
         * lockButtonHelper( place++, "Tutorial: Hold it!", "leftTutorial" );
         * lockButtonHelper( place++, "Closed Spaces", "AJLevel" );
         * lockButtonHelper( place++, "Fanning Out", "AJLevel2" );
         * lockButtonHelper( place++, "Combined Skills", "AJLevel3" );
         * lockButtonHelper( place++, "Forkroads", "ColterMidLevel" );
         * lockButtonHelper( place++, "Dash up", "TalanDash" );
         * lockButtonHelper( place++, "Acrobatics", "AJLevel4" );
         * lockButtonHelper( place++, "Leap of Faith", "leapoffaith" );
         */

        if (checkButton(1, "Up and Up"))
        {
            ScreenTransitioner.Instance.TransitionTo("UpTutorial");
        }

        int place = 2;

        lockButtonHelper(place++, "Dashing along", "TalansLevel");
        lockButtonHelper(place++, "New Heights", "JumpAndDownPractice_1");
        lockButtonHelper(place++, "Hold it!", "leftTutorial");
        lockButtonHelper(place++, "Closed Spaces", "AJLevel");
        lockButtonHelper(place++, "Fanning Out", "AJLevel2");
        lockButtonHelper(place++, "Forkroads", "ColterMidLevel");
        lockButtonHelper(place++, "Dash up", "TalanDash");
        lockButtonHelper(place++, "Acrobatics", "AJLevel4");
        lockButtonHelper(place++, "Leap of Faith", "leapoffaith");
        lockButtonHelper(place++, "Shatter Fun", "AJLevel5");
        lockButtonHelper(place++, "Combined Skills", "AJLevel3");


        Matrix4x4 matrixBackup = GUI.matrix;

        float titleWidth  = Screen.width * (0.45f + Mathf.Sin(time) * 0.02f);
        float titleHeight = titleWidth / (682 / ((float)148));
        float titleX      = Screen.width / 2;
        float titleY      = Screen.height * (0.1f + Mathf.Sin(time) * 0.01f);

        GUIUtility.RotateAroundPivot(Mathf.Sin(time / 2) * 5, new Vector2(titleX, titleY));
        GUI.DrawTexture(new Rect(titleX - titleWidth / 2, titleY - titleHeight / 2, titleWidth, titleHeight), header);

        GUI.matrix = matrixBackup;
    }