Ejemplo n.º 1
0
 private void Awake()
 {
     theTransform = transform;
     anim = GetComponent<Animator>();
     playerH = GetComponent<PlayerHealth>();
     rigid = GetComponent<Rigidbody2D>();
     positions = GameObject.FindWithTag("Scripts").GetComponent<Positions>();
     reset = GameObject.FindWithTag("Scripts").GetComponent<Reset>();
     enemies = GameObject.FindGameObjectsWithTag("Enemy");
     tips = GameObject.FindWithTag("UI").GetComponent<HelpfulTips>();
     showPanels = GameObject.FindWithTag("UI").GetComponent<ShowPanels>();
     scenes = GameObject.FindWithTag("Scripts").GetComponent<Scenes>();
     if (!isRight)
         reset.ResetHelmet();
     rigid.gravityScale = 0f;
     GetComponentInChildren<SpriteRenderer>().enabled = false;
 }
Ejemplo n.º 2
0
    private Scenes scenes;                      // Reference to the Scenes script.


    /**
     * Variables and game states are initialized before the game starts.
     */
    private void Awake()
    {
        theTransform = transform;
        anim         = GetComponent <Animator>();
        playerH      = GetComponent <PlayerHealth>();
        rigid        = GetComponent <Rigidbody2D>();
        positions    = GameObject.FindWithTag("Scripts").GetComponent <Positions>();
        reset        = GameObject.FindWithTag("Scripts").GetComponent <Reset>();
        enemies      = GameObject.FindGameObjectsWithTag("Enemy");
        tips         = GameObject.FindWithTag("UI").GetComponent <HelpfulTips>();
        showPanels   = GameObject.FindWithTag("UI").GetComponent <ShowPanels>();
        scenes       = GameObject.FindWithTag("Scripts").GetComponent <Scenes>();
        if (!isRight)        //case analysis of the direction of the helmet
        {
            reset.ResetHelmet();
        }
        rigid.gravityScale = 0f;
        GetComponentInChildren <SpriteRenderer>().enabled = false;
    }