Tempreture drop script "spirit ontriggerstay" problems.
Hey ive been pushing my self to try new ideas with scripts with a mild knowledge of unity script. The script is for the room tempreture to drop on entering a spirt, then trigger an event. So far i have whats follows but the debug log dosnt confirm its working. Also is there a better way of writing this script maybe as part of a manager script?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class roomTemp : MonoBehaviour {
public bool TempDrop = false;
public int roomtemp;
public GameObject spirit;
public Collider col;
// Use this for initialization
void Start ()
{
roomtemp = 15;
Debug.Log (roomtemp);
if(TempDrop == true)
{
roomtemp = -15;
}
}
// Update is called once per frame
void OnTriggerEnter (Collider col) {
{
if (col.tag == "spirit")
{
TempDrop = true;
}
Debug.Log (roomtemp);
}
}
}
Comment