void Start()
 {
     r           = GetComponent <Renderer>();
     c           = r.material.color;
     player      = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
     playerHPBar = GameObject.Find("HitpointBar").GetComponent <HitpointBar>();
 }
示例#2
0
    void Start()
    {
        rb             = GetComponent <Rigidbody2D>();
        playerAnimator = GetComponent <Animator>();
        playerCollider = GetComponent <Collider2D>();
        moving         = false;
        grounded       = false;
        falling        = false;
        hitpointBar    = GameObject.Find("HitpointBar").GetComponent <HitpointBar>();

        audioSource = GetComponent <AudioSource>();

        inventoryGO = GameObject.Find("InventoryManager");
        inventory   = inventoryGO.GetComponent <SwordInventory>();
        swordPossessions.Add(0);
        addSwords();
        getInventorySwords();
        activeSwordIndex = inventory.index;
        pauseMenu        = GameObject.Find("PauseMenu");
        playerHPBar      = GameObject.Find("HitpointBar").GetComponent <HitpointBar>();

        Scene currentScene = SceneManager.GetActiveScene(); // To know which level

        sceneName      = currentScene.name;
        brickSwordHeld = false; // for sword pickup only
    }
示例#3
0
 public virtual void Start()
 {
     player          = GameObject.Find("Player");
     playerRigidbody = player.GetComponent <Rigidbody2D>();
     playerHPBar     = GameObject.Find("HitpointBar").GetComponent <HitpointBar>();
     playerScript    = player.GetComponent <Player>();
 }
示例#4
0
    public int state = 1;     // 1: idle, 2: moving left, 3: moving right, 4: attacking

    new public void Start()
    {
        base.Start();
        playerHPBar   = GameObject.Find("HitpointBar").GetComponent <HitpointBar>();
        rigidbody     = GetComponent <Rigidbody2D>();
        cobraAnimator = GetComponent <Animator>();
        hurtColor     = GetComponent <SpriteRenderer>();
        moving        = false;
        attacking     = false;
        dieing        = false;
    }
示例#5
0
 private new void Start()
 {
     player       = GameObject.FindGameObjectWithTag("Player");
     sr           = GetComponent <SpriteRenderer>();
     light        = GameObject.Find("PurpleGhostLightEmission").GetComponent <Light>();
     rg           = GetComponent <Rigidbody2D>();
     playerBar    = GameObject.Find("HitpointBar").GetComponent <HitpointBar>();
     music        = GameObject.Find("Music").GetComponent <Music>();
     audioSources = music.GetComponents <AudioSource>();
     audioSources[2].Stop();
     transform.GetComponent <AudioSource>().Play();
     transform.GetComponent <SpriteRenderer>().flipX = true;
 }
示例#6
0
    new void Start()
    {
        base.Start();
        Scene currentScene = SceneManager.GetActiveScene();         // To know which level

        sceneName   = currentScene.name;
        player      = GameObject.Find("Player").GetComponent <Player>();
        playerHPBar = GameObject.Find("HitpointBar").GetComponent <HitpointBar>();
        rigidbody   = GetComponent <Rigidbody2D>();
        hurtColor   = GetComponent <SpriteRenderer>();
        movingRight = true;
        hitSound    = GetComponent <AudioSource>();
        hasPlayed   = false;
        lightsword  = FindObjectOfType <LightSword>();
    }
示例#7
0
    void OnTriggerEnter2D(Collider2D col)
    {
        // Will be used later once we have a player attacking the boss
        HitpointBar playerHPBar = GameObject.Find("HitpointBar").GetComponent <HitpointBar>();

        if (col.gameObject.name == "Player")
        {
            playerHPBar.DecreaseHitpoint(5);
            playerHurtSound();
            Destroy(gameObject);
        }
        if (col.tag == "Ground")
        {
            Destroy(gameObject);
        }
    }
示例#8
0
    new public void Start()
    {
        base.Start();
        playerHPBar = GameObject.Find("HitpointBar").GetComponent <HitpointBar>();
        rb          = GetComponent <Rigidbody2D>();
        hurtColor   = GetComponent <SpriteRenderer>();
        movingRight = true;
        hitSound    = GetComponent <AudioSource>();
        hasPlayed   = false;

        // Freeze properties
        freezeable       = true;
        freezeCubeOffset = new Vector3(0, 0.5f);
        freezeCubeScale  = new Vector3(0.1f, 0.2f, 0.1f);
        freezeCubeScale  = new Vector3(0.1f, 0.2f, 0.1f);
    }
示例#9
0
 new void Start()
 {
     base.Start();
     playerHPBar          = GameObject.Find("HitpointBar").GetComponent <HitpointBar>();
     hurtColor            = GetComponent <SpriteRenderer>();
     rb                   = GetComponent <Rigidbody2D>();
     playerRigidBody      = GameObject.Find("Player").GetComponent <Rigidbody2D>();
     playerGO             = GameObject.Find("Player").GetComponent <Player>();
     playerPosition       = GameObject.Find("Player").GetComponent <Transform>();
     transform.localScale = new Vector3(0, 0, 0); // Hide for the intro
     isSpawned            = true;
     audioSources         = GetComponents <AudioSource>();
     music                = GameObject.Find("Music").GetComponent <Music>();
     BGM                  = music.GetComponents <AudioSource>();
     BGM[1].Stop();
     audioSources[2].Play();
     projectileSound = audioSources[0];
     morphSound      = audioSources[1];
     MorphAnimation();
 }
示例#10
0
 new void Start()
 {
     player      = GameObject.Find("Player");
     playerHPBar = GameObject.Find("HitpointBar").GetComponent <HitpointBar>();
 }