Esempio n. 1
0
 // Start is called before the first frame update
 void Start()
 {
     joystick      = BackgroundImage.GetComponent <VirtualJoystick>();
     joystick2     = BackgroundImage2.GetComponent <VirtualJoystick2>();
     UnityChanSelf = this.GetComponent <Animator>();
     Debug.Log("HELO");
 }
    // Start is called before the first frame update
    void Start()
    {
        last = Time.realtimeSinceStartup;
        if (PlayerPrefs.GetString("step") != "1" && System.IO.File.Exists(Application.persistentDataPath + "/save.txt"))
        {
            FileStream   fs = new FileStream(Application.persistentDataPath + "/save.txt", FileMode.Open);
            StreamReader sr = new StreamReader(fs);

            this.transform.position = new Vector3(Convert.ToSingle(sr.ReadLine()), Convert.ToSingle(sr.ReadLine()), Convert.ToSingle(sr.ReadLine()));
            this.transform.rotation = QuaternionParse(sr.ReadLine());
            floor = sr.ReadLine();
            if (floor == "SceneMap2" && SceneManager.GetActiveScene().name == "SceneMap")
            {
                SceneManager.LoadScene("SceneMap2");
            }
            Coin_save = Convert.ToInt32(sr.ReadLine());
            RealGold.GetComponent <Text>().text = Convert.ToString(Coin_save);

            sr.Close();
            fs.Close();
            Debug.Log("read");
        }

        joystick  = BackgroundImage.GetComponent <VirtualJoystick>();
        joystick2 = BackgroundImage2.GetComponent <VirtualJoystick2>();
        MainCamera.GetComponent <Transform>().rotation    = this.transform.rotation;
        MainCamera.GetComponent <Transform>().eulerAngles = new Vector3(20.0f, MainCamera.GetComponent <Transform>().eulerAngles.y, MainCamera.GetComponent <Transform>().eulerAngles.z);

        UnityChanPosition  = this.GetComponent <Transform>().position;
        CameraFollowVector = new Vector3(UnityChanPosition.x, 3.2f, UnityChanPosition.z);
        MainCamera.GetComponent <Transform>().position = CameraFollowVector;
        MainCamera.GetComponent <Transform>().Translate(Vector3.back * 5);
        hp = new GameObject[] {
            GameObject.Find("Heart"),
            GameObject.Find("Heart (1)"),
            GameObject.Find("Heart (2)"),
        };
        hpcnt            = 2;
        fireCollideDelay = -1;

        isStageStarted            = false;
        SceneManager.sceneLoaded += OnSceneLoaded;
    }
 // NavMeshAgent navMeshAgent;
 // Use this for initialization
 void Start()
 {
     joystick = gameObject.GetComponent<VirtualJoystick2>();
     //     rBody = GetComponent<Rigidbody>();
     agent = GetComponent<NavMeshAgent>();
 }