Last active
August 29, 2015 14:05
-
-
Save bricef/0354eac6025a04a24b83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma strict | |
var damage = 20; | |
var vel = Vector2(0,10); | |
var boom : AudioClip; | |
function Start () { | |
rigidbody2D.velocity = vel; | |
} | |
function Update () { | |
} | |
function OnCollisionEnter2D(col : Collision2D){ | |
var target = col.gameObject.GetComponent(IDamagable); | |
if(target){ | |
Destroy(collider); | |
renderer.enabled = false; | |
target.Damage(30.0); | |
audio.PlayOneShot(boom); | |
} | |
Invoke("Nuke", boom.length); | |
} | |
function Nuke(){ Destroy(gameObject); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment