public void TeleportObject(string posname) { //Make pos so we don't overwrite destination on bad lookups. Transform pos; if (PositionInfo.FindByName(positions, posname, out pos)) { destination = pos.position; transform.position = destination; } }
public void MoveObject(string posname) { //Make pos so we don't overwrite destination on bad lookups. Transform pos; if (PositionInfo.FindByName(positions, posname, out pos)) { moving = true; destination = pos.position; } }
/* * public void TeleportObject(GameObject mover, GameObject g, string posname) * { * //Make pos so we don't overwrite destination on bad lookups. * Transform pos; * if ( PositionInfo.FindByName(positions, posname, out pos) ) * { * destination = pos.position; * g.transform.position = destination; * } * } */ //Object mover invoked with dynamic args (from say, collision) will move the collided object //To the FIRST position public void TeleportObject(GameObject mover, GameObject g, string posname = "") { if (posname == "") { if (positions != null && positions.Length > 0) { string posname = positions[0].name; } else { return; } } //Make pos so we don't overwrite destination on bad lookups. Transform pos; if (PositionInfo.FindByName(positions, posname, out pos)) { destination = pos.position; g.transform.position = destination; } }