void SpawnTail() { GameObject obj = Instantiate(Resources.Load <GameObject>("SnakeBody")) as GameObject; obj.transform.position = SnakeBodyManager.Instance.Bodies[0].transform.position; SnakeBody newBody = obj.GetComponent <SnakeBody>(); SnakeBodyManager.Instance.Bodies.Insert(0, newBody); SnakeBodyManager.Instance.Bodies[0].Front = SnakeBodyManager.Instance.Bodies[1]; SnakeBodyManager.Instance.Bodies[1].Back = SnakeBodyManager.Instance.Bodies[0]; newBody.ScaleDown(); newBody.CheckPointLoaded = true; }
void CollisionAgainstSelf(Collider other) { if (this == SnakeBodyManager.Instance.SNAKE_HEAD) { if (!SnakeBodyManager.Instance.FirstUpdate) { SnakeBody collidedBody = other.gameObject.GetComponent <SnakeBody>(); if (collidedBody != null) { SnakeBodyManager.Instance.PLAYER.IsDead = true; SpawnSnakeDeathEffects(this.transform.position); CameraManager.Instance.CAMERA_CONTROL.ZoomInAndOut(0.15f, 0.2f); other.gameObject.GetComponent <MeshRenderer>().enabled = false; } } } }