示例#1
0
 // Use this for initialization
 protected override void Start()
 {
     guictrl = GameObject.Find("Canvas/GameUI").GetComponent <CityUIController>();
     if (isTutorial)
     {
         transform.position = new Vector3(-100, transform.position.y);
     }
     else
     {
         Init();
     }
 }
    void Start()
    {
        Time.timeScale = 1f;
        guic           = GameObject.Find("Canvas/GameUI").GetComponent <CityUIController> ();
        //pc = GameObject.FindGameObjectWithTag ("Player").GetComponent<SkateController> ();

        // Get Level from Scene name
        string    sceneName = SceneManager.GetActiveScene().name;
        LevelEnum lvlEnum   = (LevelEnum)Enum.Parse(typeof(LevelEnum), sceneName);

        this.level = ApplicationController.ac.levels [lvlEnum];

        // Init target
        targetKittyz = level.targetKittyz;
        targetTime   = level.targetTime;
        targetLife   = level.targetLife;

        // Load checkpoint if exists for this level

        /*GameObject checkpointControllerObject = GameObject.Find ("CheckPointController");
         * if (checkpointControllerObject) {
         *      CheckPointController checkpointController = checkpointControllerObject.GetComponent<CheckPointController> ();
         *      if (checkpointController.levelEnum == lvlEnum)
         *              checkpointController.Load ();
         *      else
         *              checkpointController.Reset (lvlEnum);
         * }*/

        // Check if we have to diplay to tip if the player get hit
        hasTipBeenConsulted = ApplicationController.ac.IsTipAlreadyConsulted(TipEnum.BUY_LIFE);

        // Analytics
        Analytics.CustomEvent("LevelStarted_" + this.level.name, new Dictionary <string, object> {
            { "date", System.DateTime.Now.ToString() },
            { "kittys_total", ApplicationController.ac.playerData.kittyz }
        });
    }