void OnCollisionEnter(Collision other) { if (!wasDropped) { // // if this obj collides w other non-movable objects in the world // if((other.rigidbody == null // || (other.rigidbody.isKinematic && other.gameObject.tag != "Player"))) // return; // // switch(objType) // { // case ObjectType.PLASTIC: // break; // case ObjectType.WOOD: // break; // case ObjectType.METAL: // break; // case ObjectType.FRAGILE: // break; // } // // if(SFXdelay <= 0) // { // SFXdelay = SFX_DELAY; // // if(hitSFX != null) // AudioSource.PlayClipAtPoint(hitSFX, transform.position); // } // // // AImanager.AddAlertGlobally(transform.position); } else { wasDropped = false; //reset since this obj landed on the floor/other obj if (SFXdelay <= 0) { SFXdelay = SFX_DELAY; if (dropSFX != null) { AudioSource.PlayClipAtPoint(dropSFX, transform.position); } } AImanager.AddAlertGlobally(transform.position); // add diff alert based on type if gt time switch (objType) { case ObjectType.PLASTIC: break; case ObjectType.WOOD: break; case ObjectType.METAL: break; case ObjectType.FRAGILE: Destroy(this.gameObject); break; } } }