void OnCollisionEnter2D(Collision2D info) { if (!gen.dead && gen.deathFall) { print("ouch!"); gen.dead = true; gen.deathFall = false; gen.Invoke("CreateGhost", 1f); } }
void KillGhost(generalMovement gen) { rb.velocity = Vector3.zero; GetComponentInParent <ghostMovement>().canMove = false; GameObject ghostPart = Instantiate(particle, transform.position, transform.rotation) as GameObject; ghostPart.GetComponent <particleAttractor>().obj = gen.transform; gen.enabled = true; gen.dead = false; gen.Invoke("GetUp", 2f); Camera.main.GetComponent <cameraMove>().player = gen.transform; Destroy(transform.parent.gameObject, 2f); }