Example #1
0
 void OnCollisionEnter2D(Collision2D collision)
 {
     if(collision.gameObject.tag == "Enemy") {
         theEnemy = collision.gameObject;
         fb = theEnemy.GetComponent<FishyBehavior>();
         float dmg = fb.damageToPlayer;
         float health = fb.healthSystemAmount;
         playerHealthSystem.removeHealth(dmg);
         hs.startShake();
         ah.playDamage();
         ContactPoint2D contactPoint = collision.contacts[collision.contacts.Length -1];
         Instantiate(gibs, contactPoint.point, Quaternion.identity);
         if (fb.attacking){
             fb.attacking = false;
             fb.returningToSpawnPoint = true;
         }
     }
 }
Example #2
0
 void OnCollisionEnter2D(Collision2D collision)
 {
     if(collision.gameObject.tag == "Enemy") {
         theEnemy = collision.gameObject;
         fb = theEnemy.GetComponent<FishyBehavior>();
         dmg = fb.bitePain;
         health = fb.healthSystemAmount;
         theEnemy.GetComponent<HealthSystem>().removeHealth(dmg);
         thePlayer.GetComponent<HealthSystem>().addHealth(health);
         hs.startShake();
         ah.playEat();
         contactPoint = collision.contacts[collision.contacts.Length-1];
         Instantiate(gibs, contactPoint.point, Quaternion.identity);
         if(Time.time > nextChain){
             nextChain = Time.time + chainRate;
             aet.chainPlay();
         }
     }
 }
Example #3
0
 void Start()
 {
     blinky = GetComponent<Blinker> ();
     sound = GetComponent<AudioSource> ();
     gc = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();
     aet = GameObject.FindGameObjectWithTag ("Player").GetComponent<AudioEngineThing> ();
     fishy = transform.GetComponent<FishyBehavior> ();
     dead = false;
     isEnemy = false;
     if (this.gameObject.tag == "Enemy")
         isEnemy = true;
 }