Hi guys,
I have a few doors and few keys to open specific doors. what I am trying to do is to create a function so that i can reuse them.
The problem that i encounter is converting a series of string to boolean. Can't use parseBoolean(); Don't even know that it is the correct way to do it or is there a better way? Please assist and thanks in advance!
var doorNum: int;
static var accessGranted_1: boolean;
var isOpen_1: boolean = false;
checkTileOpenDoor_spaceship(1);
function checkTileOpenDoor_spaceship(doorNum){
var doorIndex: int = doorNum;
var currentTileTypeIndex: String = "TileOpenDoor_" + doorIndex;
var isOpenIndex: boolean = parseBoolean("isOpen_" + doorIndex);
var accessGrantedIndex: boolean = parseBoolean("accessGranted_" + doorIndex);
var TileEndIndex: String = "TileEnd_" + doorIndex;
if (currentTileType == currentTileTypeIndex && !isOpenIndex && accessGranted){
//open door
GameObject.Find(TileEndIndex).animation.wrapMode = WrapMode.Once;
GameObject.Find(TileEndIndex).animation.Play("open");
isOpenIndex = true;
} else if (currentTileType != currentTileTypeIndex && isOpenIndex){
//close door
GameObject.Find(TileEndIndex).animation.wrapMode = WrapMode.Once;
GameObject.Find(TileEndIndex).animation.Play("close");
isOpenIndex = false;
}
}
Rdgs, James Ser