public void DestroyThisPerson() { //send this objects destruction score, stat update and special to the StatManager. stm.currentScore += destructionScore; stm.peopleDestroyed++; pm.playerCurrentSpecial += specialScore; //add force to rb of object to boot it out of the way. //ppRB.AddForce(0.0f, colForce, 0.0f); //bring in a death FX from pool. sm.SpawnFXs(sm.ppDesFXPool, sm.selectedPpDesFX, gameObject); //bring in a death SFX from pool. sm.SpawnFXs(sm.sfxPpDesPool, sm.selectedSFXPpDes, gameObject); //deactivate and pop back into people pool. sm.BackToPool(sm.peoplePool, sm.peoplePoolPosition, this.gameObject); }
// public void DestroyThisVehicle() { //send this objects destruction score, special and stats to the StatManager. stm.currentScore += destructionScore; stm.vehiclesDestroyed++; pm.playerCurrentSpecial += specialScore; //get FXs from its object pool and bring into scene. sm.SpawnFXs(sm.carExFXPool, sm.selectedCarExFX, gameObject); //get SFX from its object pool and bring into scene. sm.SpawnFXs(sm.sfxVehDesPool, sm.selectedSFXVehDes, gameObject); //deactivate and pop back into vehicle pool. sm.BackToPool(sm.vehiclePool, sm.vehiclePoolPosition, gameObject); }
void Update() { //check whether WalkIcon, if so destroy after 4 seconds. if (gameObject.tag == "WalkIcon") { Destroy(gameObject, 2.0f); } //otherwise not WalkIcon, check if it has stopped playing and send back to pool. else if (myPS.isStopped) { //scenery destruction if (gameObject.tag == "ScnDesFX") { sm.BackToPool(sm.scnDesFXPool, sm.scnDesFXPoolPosition, gameObject); } //vehicle destruction else if (gameObject.tag == "CarExFX") { sm.BackToPool(sm.carExFXPool, sm.carExFXPoolPosition, gameObject); } //this is for the building damage else if (gameObject.tag == "BuildExFX") { sm.BackToPool(sm.buildExFXPool, sm.buildExFXPoolPosition, gameObject); } //building destruction else if (gameObject.tag == "BuildDesFX") { sm.BackToPool(sm.buildDAMFXPool, sm.buildDAMFXPoolPosition, gameObject); } //factory destruction else if (gameObject.tag == "FactDesFX") { sm.BackToPool(sm.factDesFXPool, sm.factDesFXPoolPosition, gameObject); } else if (gameObject.tag == "PeopleDesFX") { sm.BackToPool(sm.ppDesFXPool, sm.ppDesFXPoolPosition, gameObject); } else { Destroy(gameObject); } } }