Hello,
I know im making a leap in logic somewhere, But i cant find it.
What i want to do,
- Find if the object with the LevelSelectA1 Script is touching and STAYING in the trigger, (Trigger is a seperate GameObj and yes the trigger checkbox is checked)
- IF the Obj is triggering the trigger, Then a boolean is set true, if it exits the boolean is false.
- IF its true and if it is clicked it plays an iTween animation! And a Select sound
Refresh me, if im wrong but don’t you set up the OTHER collider with the trigger box checked?
Am I possibly missing anything?
Here is the code:
var initialColor:Color;
var SelectColor:Color;
var SelectSound : AudioClip;
var FingerOverSound : AudioClip;
var menuCam : GameObject;
var A1 : GameObject;
var ReadyPOS : boolean = false;
function Start()
{
initialColor = renderer.material.color;
}
function OnMouseExit(){
renderer.material.color = initialColor;
}
function OnMouseOver(){
if (ReadyPOS) {
renderer.material.color = SelectColor;
}
}
function OnMouseEnter () {
if (ReadyPOS) {
audio.clip = FingerOverSound;
audio.Play();
}
}
function OnMouseDown () {
if (ReadyPOS) {
audio.clip = SelectSound;
audio.Play();
iTweenEvent.GetEvent(menuCam, "AreaSelectToLevelSelect").Play();
iTweenEvent.GetEvent(A1, "DiamondMoveToLevelSelectFromAreaSelect").Play();
}
}
function OnTriggerStay (other : Collider) {
ReadyPOS = true;
}
function OnTriggerExit (other : Collider) {
ReadyPOS = false;
}
Thanks for the Help!
Daniel