Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        pause = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Pause>();

        hs   = GameObject.FindGameObjectWithTag("Help").GetComponent <HelpScript>();
        time = GameObject.FindGameObjectWithTag("TimeControl").GetComponent <TimeControl>();

        walkSound     = GameObject.FindGameObjectWithTag("WalkSound").GetComponent <AudioSource>();
        jumpSound     = GameObject.FindGameObjectWithTag("PlayerJumpSound").GetComponent <AudioSource>();
        shootSound    = GameObject.FindGameObjectWithTag("ShootSound").GetComponent <AudioSource>();
        deathSound    = GameObject.FindGameObjectWithTag("DeathSound").GetComponent <AudioSource>();
        safeSpotSound = GameObject.FindGameObjectWithTag("FireSound").GetComponent <AudioSource>();
        pickUpSound   = GameObject.FindGameObjectWithTag("PickUpSound").GetComponent <AudioSource>();
        stealSound    = GameObject.FindGameObjectWithTag("StealSound").GetComponent <AudioSource>();


        rBody    = gameObject.GetComponent <Rigidbody2D>();
        anim     = gameObject.GetComponent <Animator>();
        renderer = gameObject.GetComponent <SpriteRenderer>();

        originalColor = renderer.material.color;
        currHealth    = maxHealth;
        currSanity    = maxSanity;
        currFed       = maxFed;
        mushroom      = 1;
        weed          = 1;
        wood          = 1;
        stone         = 1;
    }
Esempio n. 2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
    void Awake()
    {
        helpscript = GameObject.Find("Helper").GetComponent <HelpScript>();

        if (ifHelped != null)
        {
            if (helpscript.bearHelp)
            {
                ifHelped.SetActive(true);
                if (ifNotHelped != null)
                {
                    ifNotHelped.SetActive(false);
                }
            }
            else
            {
                ifNotHelped.SetActive(true);
                if (ifNotHelped != null)
                {
                    ifHelped.SetActive(false);
                }
            }
        }
    }