Destroy by boundary in Unity

using UnityEngine;
using System.Collections;
public class DestroyByBoundary : MonoBehaviour {
private PlayerController playerController;
private PlayGui playGui;
void Start()
{
//////
GameObject playerControllerObject = GameObject.FindWithTag (“Player”);
if (playerControllerObject != null)
{
playerController = playerControllerObject.GetComponent <PlayerController>();
//Debug.Log (“I did find ‘Player’ script”);
}
if (playerController == null)
{
Debug.Log (“Cannot find ‘Player’ script”);
}
//////
//////
GameObject gameControllerObject = GameObject.FindWithTag (“GuiElement”);
if (gameControllerObject != null)
{
playGui = gameControllerObject.GetComponent <PlayGui>();
// Debug.Log (“I did find ‘PlayGui’ script”);
}
if (playGui == null)
{
Debug.Log (“Cannot find ‘PlayGui’ script”);
}
//////
}
void OnTriggerEnter(Collider other)
{
Instantiate (playerController.explosionPlayer, playerController.player.transform.position, playerController.player.transform.rotation);
Destroy (playerController.player.gameObject);
Instantiate (playerController.explosion, transform.position, transform.rotation);
other.gameObject.SetActive (false);
playGui.ShowBondryDestroyMenu();
playGui.HideElements();
}
}
Add your comment

Your email address will not be published. Required fields are marked *