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

        if (player != null)
        {
            player.ChangeHealth(-1);
            playerController.PlaySound(healthDamageSound);
        }
    }
예제 #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);
            }
        }
    }
예제 #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();
 }
예제 #6
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController>();

        if (controller != null)
        {
            controller.PlaySound(collectedClip);
        }
    }
예제 #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);
     }
 }
예제 #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);
        }
    }
예제 #10
0
    void OnTriggerStay2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController>();

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

        if (player)
        {
            player.ChangeHealth(enemyDamage);
            player.PlaySound(PickRandomSound());
        }
    }
예제 #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);
        }
    }
예제 #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);
        }
    }
예제 #15
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController> ();

        if (controller != null)
        {
            controller.AddCogs();
            controller.PlaySound(collectedClip);
            Destroy(gameObject);
        }
    }
예제 #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);
        }
    }
예제 #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);
        }
    }
예제 #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);
        }
    }
예제 #20
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        RubyController controller = collision.GetComponent <RubyController>();

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

            controller.PlaySound(collectedClip);
        }
    }
예제 #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);
        }
    }
예제 #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);
        }
    }
예제 #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);
        }
    }
예제 #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;
        }
    }
예제 #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);
        }
    }
예제 #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);
            }
        }
    }
예제 #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);
            }
        }
    }
예제 #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);
         }
     }
 }
예제 #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);
            }
        }
    }