//Gather required components, and if the player selected a dino in the main menu, set up the sprites, and finally invoke the hunger loss
    private void Start()
    {
        spriteRenderer = GetComponent <SpriteRenderer>();
        animator       = GetComponent <DinoAnimator>();
        screenWidth    = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0.0f, 0.0f)).x - spriteRenderer.bounds.size.x / 2;
        if (Settings.instance != null)
        {
            animator.runningSprites = Settings.instance.GetRunningSprites();
            animator.deathSprites   = Settings.instance.GetDeathSprites();
        }

        animator.RunningAnimation();

        startingHunger = dinoHunger;

        rb          = GetComponent <Rigidbody2D>();
        cameraShake = mainCam.GetComponent <CameraShake>();

        InvokeRepeating("HungerEnumerator", 0f, 0.25f);
    }
Exemple #2
0
    //Gather required components, and if the player selected a dino in the main menu, set up the sprites, and finally invoke the hunger loss
    private void Start()
    {
        spriteRenderer = GetComponent <SpriteRenderer>();
        animator       = GetComponent <DinoAnimator>();

        if (Settings.instance != null)
        {
            animator.runningSprites = Settings.instance.GetRunningSprites();
        }

        animator.RunningAnimation();

        startingHunger = dinoHunger;

        rb          = GetComponent <Rigidbody2D>();
        audioSource = GetComponent <AudioSource>();
        cameraShake = mainCam.GetComponent <CameraShake>();

        InvokeRepeating("HungerEnumerator", 0f, 0.25f);
    }