void Explode(Collision coll) { foreach (ObjectDrag o in ObjectSpawner.draggableList) { ObjectDrag g = (ObjectDrag)o; Rigidbody collidingObject = coll.rigidbody; g.Exploder(explosionForce, transform.position, explosionRadius, upwardsModifier, mode); } ObjectSpawner.draggableList.Remove(this.GetComponent <ObjectDrag>()); Destroy(this.gameObject); }
public void SpawnWaypoint() { Vector3 mousePos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 10); Vector3 objPos = Camera.main.ScreenToWorldPoint(mousePos); waypointList.Add((GameObject)Instantiate(prefabWaypoint, objPos, Quaternion.identity)); ObjectDrag script = waypointList[numWaypoints].GetComponent <ObjectDrag>(); script.isAttached = true; numWaypoints++; }