Example #1
0
    void OnCollisionEnter(Collision collision)
    {
        Flammable flammable = collision.gameObject.GetComponent <Flammable> ();

        if (flammable != null)
        {
            flammable.SetOnFire(collision.contacts [0].point);
        }
    }
Example #2
0
 void Start()
 {
     RaycastHit2D[] results = Physics2D.CircleCastAll(transform.position, EXPLOSION_RADIUS, Vector2.zero, 0);
     foreach (RaycastHit2D result in results)
     {
         Flammable flammable = result.collider.gameObject.GetComponent <Flammable>();
         if (flammable)
         {
             flammable.SetOnFire();
         }
         Mortal mortal = result.collider.gameObject.GetComponent <Mortal>();
         if (mortal)
         {
             mortal.Damage(gameObject.tag, EXPLOSION_DAMAGE);
         }
     }
     Camera.main.gameObject.GetComponent <CameraHelper>().Shake();
     SoundManager.Play(explosionSound);
 }
Example #3
0
File: Car.cs Project: xiabob/ld46
 void OnCollisionEnter2D(Collision2D collision)
 {
     if (IsMoving() && body.velocity.sqrMagnitude > CRASH_SPEED_THRESHOLD)
     {
         SpriteSquish spriteSquish = collision.gameObject.GetComponent <SpriteSquish>();
         if (spriteSquish)
         {
             spriteSquish.SquishThin();
         }
         Flammable flammable = collision.gameObject.GetComponentInChildren <Flammable>();
         if (flammable)
         {
             this.flammable.SetOnFire();
             flammable.SetOnFire();
         }
         Mortal mortal = collision.gameObject.GetComponent <Mortal>();
         if (mortal)
         {
             mortal.Damage(gameObject.tag, CAR_CRASH_DAMAGE);
         }
     }
 }
Example #4
0
    void Start()
    {
        int burningCount = 0;

        for (int i = 0; i < 25; i++)
        {
            GameObject go = SpawnStructure(housePrefab);
            if (go != null && burningCount < INITIAL_FIRE_HOUSES)
            {
                burningCount++;
                Flammable f = go.GetComponentInChildren <Flammable>();
                f.SetOnFire();
            }
        }
        for (int i = 0; i < 10; i++)
        {
            SpawnStructure(apartmentPrefab);
        }
        spawningTrees = true;
        for (int i = 0; i < 20; i++)
        {
            SpawnStructure(treePrefab);
        }
    }