Пример #1
0
    private void Awake()
    {
        Instance = this;

        player_Animation = GetComponent <Player_Animation>();
        player_Stats     = GetComponent <Player_Stats>();
        player_Collision = GetComponent <Player_Collision>();
        player_Actions   = GetComponent <Player_Actions>();
        player_Input     = GetComponent <Player_Input>();
        player_Equipment = GetComponent <Player_Equipment>();
        player_Quest     = GetComponent <Player_Quest>();
        player_Event     = GetComponent <Player_Events>();

        animator = GetComponent <Animator>();
        rb2D     = GetComponent <Rigidbody2D>();
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (fuel > 3.5f)
        {
            fuel = 3.5f;
        }
        if (fuel < 0.001f)
        {
            //StartCoroutine(functionForWaiting());
            //MainCamera.transform.position = Vector3.Lerp(MainCamera.transform.position, new Vector3(-8.5f, 4f, -10f), Time.time );
            StartCoroutine(FadeOut(MainCamera.transform.position, new Vector3(-8.5f, 4f, -10f), 3f));
            Camera_FollowPlayer.isPlaying = false;
            Player_Move.isPlayerMoving    = false;

            GetComponent <AudioSource>().PlayOneShot(death, 1f);
            Player_Collision.playerDies();
            fuel = 3.5f;
        }

        fuel -= 0.001f;

        if (Input.GetButton("Fire1") && fuel >= 0.001f)
        {
            GetComponent <AudioSource>().PlayOneShot(jump, 0.5f);
            GoUp();
            isGround = false;
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.LoadLevel("Main");
            Player_Controller.fuel         = 3.5f;
            Player_Move.isPlayerMoving     = false;
            Camera_FollowPlayer.isPlaying  = false;
            MainCamera.transform.position  = new Vector3(-8.5f, 4f, 10f);
            Player_Collision.coincountdown = 0;
            Data_Management.datamanagement.currentScore = 0;
            Data_Management.datamanagement.LoadData();
        }

        if (!isGround)
        {
            fuel -= 0.001f;
        }
    }