private void OnCollisionEnter2D(Collision2D col) { if (!Live) { return; } if (!Launched) { return; } Astronaut a = col.gameObject.GetComponent <Astronaut>(); if ((a != null) && (a.Alive)) { crash(); return; } LavaPlatform lp = col.gameObject.GetComponent <LavaPlatform>(); if ((lp != null) && (!lp.Destroyed)) { lp.DestroyPlatform(); crash(); return; } if (col.gameObject.layer == LayerMask.NameToLayer("Geometry")) { crash(); return; } }
void RandomFloor() { // Get a random number of the gameobject children randomObject = Random.Range(0, childrenObjects.Length); // Get tge component of the platform LavaPlatform platform = transform.GetChild(randomObject).GetComponent <LavaPlatform>(); if (platform) { // Check if the platform is busy if (!platform.isWorking) { // Start the deativation StartCoroutine(platform.DeactivePlatform(activeTime, deactiveTime)); isGenerated = true; } } }