Ejemplo n.º 1
0
 public void Fix()
 {
     ruby.PlaySound(gotHit);
     rigidbody2d.simulated = false;
     animator.SetTrigger("Fixed");
     smokeEffect.Stop();
     ruby.PlaySound(gotFixed);
     ruby.RepairProgress();
 }
Ejemplo n.º 2
0
    private void OnCollisionEnter2D(Collision2D other)
    {
        RubyController player = other.gameObject.GetComponent <RubyController>();

        if (player != null)
        {
            player.ChangeHealth(-1);
            playerController.PlaySound(healthDamageSound);
        }
    }
Ejemplo n.º 3
0
    // collission checker
    private void OnTriggerEnter2D(Collider2D other)
    {
        RubyController        controller  = other.GetComponent <RubyController>();
        RubyPlatformerControl controller2 = other.GetComponent <RubyPlatformerControl>();

        if (controller != null)
        {
            if (controller.health < controller.maxHealth)
            {
                // breytir health, eyðir objectinu, synir effect og spilar hljoðið
                controller.ChangeHealth(1);
                Destroy(gameObject);
                HealthCollisionEffect = Instantiate(HealthEffect, transform.position, Quaternion.identity) as ParticleSystem;
                HealthCollisionEffect.Play();

                controller.PlaySound(collectedClip);
            }
        }

        if (controller2 != null)
        {
            if (controller2.health < controller2.maxHealth)
            {
                // breytir health, eyðir objectinu, synir effect og spilar hljoðið
                controller2.ChangeHealth(1);
                Destroy(gameObject);
                HealthCollisionEffect = Instantiate(HealthEffect, transform.position, Quaternion.identity) as ParticleSystem;
                HealthCollisionEffect.Play();

                controller2.PlaySound(collectedClip);
            }
        }
    }
Ejemplo n.º 4
0
 public void DeliverItem(bool hasKey)
 {
     ruby.PlaySound(satanShoot);
     if (hasKey)
     {
         ruby.ToggleSword();
     }
 }
 public void Fix()
 {
     broken = false;
     audioSource.Stop();
     controller.PlaySound(fixedClip);
     rigidbody2D.simulated = false;
     animator.SetTrigger("Fixed");
     smokeEffect.Stop();
 }
Ejemplo n.º 6
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController>();

        if (controller != null)
        {
            controller.PlaySound(collectedClip);
        }
    }
Ejemplo n.º 7
0
    public void Launch(Vector2 direction, float force, AudioSource audiosource)
    {
        RubyController controller = GetComponent <RubyController>();

        controller = audiosource.GetComponent <RubyController>();
        controller.PlaySound(throwCog);

        this.rigidbody2d.AddForce(direction * force);
    }
 // Start is called before the first frame update
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         ruby.PlaySound(collectSoundClip);
         gameController.GetComponent <ZezeController>().collectedCrystal += 1;
         gameController.GetComponent <ZezeController>().getCrystal();
         Destroy(gameObject);
     }
 }
Ejemplo n.º 9
0
    // Start is called before the first frame update
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController>();

        if (controller != null && controller.ChangeHealth(1, false))
        {
            Destroy(gameObject);
            controller.PlaySound(collectedClip);
        }
    }
Ejemplo n.º 10
0
    void OnTriggerStay2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController>();

        if (controller != null)
        {
            controller.ChangeHealth(-1);
            controller.PlaySound(hitFromDamageZoneClip);
        }
    }
Ejemplo n.º 11
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        RubyController player = collision.gameObject.GetComponent <RubyController>();

        if (player)
        {
            player.ChangeHealth(enemyDamage);
            player.PlaySound(PickRandomSound());
        }
    }
Ejemplo n.º 12
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController>();

        if (controller != null)
        {
            controller.ChangeHeath(-1);
            controller.PlaySound(damageClip);
        }
    }
    void OnCollisionEnter2D(Collision2D other)
    {
        RubyController player = other.gameObject.GetComponent <RubyController> ();

        if (player != null)
        {
            player.ChangeHealth(-1);
            player.PlaySound(collectedClip);
        }
    }
Ejemplo n.º 14
0
    // Start is called before the first frame update
    private void OnTriggerEnter2D(Collider2D collision)
    {
        RubyController controller = collision.GetComponent <RubyController>();

        if (controller != null && controller.health < controller.maxHealth)
        {
            controller.ChangeHealth(1);
            Destroy(gameObject);
            controller.PlaySound(collectedClip);
        }
    }
Ejemplo n.º 15
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController> ();

        if (controller != null)
        {
            controller.AddCogs();
            controller.PlaySound(collectedClip);
            Destroy(gameObject);
        }
    }
Ejemplo n.º 16
0
    void OnCollisionEnter2D(Collision2D other)
    {
        RubyController rc = other.gameObject.GetComponent <RubyController>();

        if (rc != null)
        {
            rc.changeHealth(-1);

            rc.PlaySound(collectedClip);
        }   //if
    }
    void OnTriggerEnter2D(Collider2D other)
    {
        //Debug.Log("Object that entered the trigger :"+ other);
        RubyController controller = other.GetComponent <RubyController>();

        if (controller != null)
        {
            controller.ChangeHealth(-1);
            controller.PlaySound(hitClip);
        }
    }
Ejemplo n.º 18
0
    // Checks if collision occured with player and damages player if true
    void OnCollisionEnter2D(Collision2D other)
    {
        RubyController player         = other.gameObject.GetComponent <RubyController>();
        Animator       playerAnimator = other.gameObject.GetComponent <Animator>();

        if (player != null)
        {
            if (player.getInvincible())
            {
                return;
            }

            int index = Random.Range(0, hit.Length);
            player.ChangeHealth(-1);
            hitEffect.Play();
            playerAnimator.SetTrigger("Hit");
            botHit = hit[index];
            player.PlaySound(botHit);
            player.PlaySound(playerHit);
        }
    }
Ejemplo n.º 19
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController>(); // CONTROLLER == RUBY

        Debug.Log("here");
        if (controller != null)
        {
            Debug.Log("passed");
            controller.PlaySound(ChangeLevelClip);
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
        }
    }
Ejemplo n.º 20
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        RubyController controller = collision.GetComponent <RubyController>();

        if (controller != null)
        {
            controller.AddAmmo(11);
            Destroy(gameObject);

            controller.PlaySound(collectedClip);
        }
    }
Ejemplo n.º 21
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController>();

        if (controller != null && controller.health < controller.maxHealth)
        {
            controller.ChangeHealth(1);
            Instantiate(collectionEffect, gameObject.transform.position, Quaternion.identity);
            Destroy(gameObject);
            controller.PlaySound(collectedClip);
        }
    }
Ejemplo n.º 22
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController rubyCtrl = other.GetComponent <RubyController>();

        if (rubyCtrl != null && rubyCtrl.ChangeHealth(HP))
        {
            rubyCtrl.invincibleTimer = 3;
            Destroy(gameObject);
            rubyCtrl.PlaySound(collectedClip);
            Debug.Log("Object that entered the trigger : " + rubyCtrl.gameObject);
        }
    }
Ejemplo n.º 23
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController>();

        if ((controller != null) && (controller.CurrentHealth < controller.maxHealth))
        {
            Instantiate(pickupEffect);
            controller.ChangeHealth(amount);
            controller.PlaySound(collectedClip);
            Destroy(gameObject);
        }
    }
Ejemplo n.º 24
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController>();

        if (controller != null)
        {
            controller.increaseAmmo();
            controller.setAmmoText();
            Destroy(gameObject);

            controller.PlaySound(cogCollectedAudio);
        }
    }
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController>();

        if (controller != null)
        {
            Destroy(gameObject);

            controller.PlaySound(bambiCollectedAudio);

            NonPlayerCharacter.hasFrog = true;
        }
    }
Ejemplo n.º 26
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        RubyController rubyController = other.GetComponent <RubyController>();

        if (rubyController != null && rubyController.Health < rubyController.maxHealth)
        {
            rubyController.ChangeHealth(1);
            Instantiate(collectibleEffect, transform.position, Quaternion.identity);
            Destroy(gameObject);

            rubyController.PlaySound(collectedClip);
        }
    }
Ejemplo n.º 27
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController>();

        if (controller != null)
        {
            if (controller.health < controller.maxHealth)
            {
                controller.ChangeHealth(1);
                Destroy(gameObject);
                controller.PlaySound(collectedClip);
            }
        }
    }
Ejemplo n.º 28
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController rubyController = other.GetComponent <RubyController>();

        if (rubyController != null)
        {
            if (rubyController.Lövedék < rubyController.maxLövedék)
            {
                rubyController.ChangeAmmo(LövedékDB);
                Destroy(gameObject);
                rubyController.PlaySound(collectedClip);
            }
        }
    }
Ejemplo n.º 29
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "player")
     {
         RubyController rubyController = other.GetComponent <RubyController>();
         if (rubyController.GetCurHp() < rubyController.m_fMaxHp)
         {
             rubyController.ChangeHp(1);
             rubyController.PlaySound(m_acPickUp);
             Instantiate(m_effectPickUp, transform.position, Quaternion.identity);
             Destroy(gameObject);
         }
     }
 }
Ejemplo n.º 30
0
    void OnTriggerEnter2D(Collider2D iOther)
    {
        RubyController gController = iOther.GetComponent <RubyController>();

        if (gController != null)
        {
            if (gController.gHealth < gController.cMaxHealth)
            {
                gController.ChangeHealth(1);
                Destroy(gameObject);
                gController.PlaySound(gCollectedClip);
            }
        }
    }