Tuesday, 14 May 2013

AI Information code pontentially working

using UnityEngine;
using System.Collections;
public class Information : MonoBehaviour {
 // Use this for initialization
 void Start () {

 }

 // Update is called once per frame
 void Update () {

 }


// This function checks if the player has entered a trigger
 void OnTriggerEnter(Collider other)
 {
  // The switch statement checks what tag the other gameobject is, and reacts accordingly.
  switch(other.gameObject.tag)
  {
   case "FlowerInfo":
   hitObj.gameObject.BroadcastMessage("This plant seems to have healing capabilities");
   break;
  
      case "LeavingDoor":
   hitObj.gameObject.BroadcastMessage("Hello Comrade, you are missing parts for your distress beacon, search the canyon for this parts");
            break;
  
      case "DeathSpot":
      hitObj.gameObject.BroadcastMessage("Comrade, this area appears to be very damaging towards your health");
   break;
  
  
       }
 }
}

No comments:

Post a Comment