// Use this for initialization void Start() { transitionText = GameObject.Find("TransitionControllers").GetComponent <TransitionText>(); GetComponent <SpriteRenderer>().enabled = false; if (Application.loadedLevelName == "LevelTesting" || Application.loadedLevelName == "GraphicsTesting") { this.enabled = false; } }
public override string ToString() { string ret = ""; ret += isSeries > 0 ? "Series of " : ""; ret += SourceSide.Trim().Length > 0 ? SourceSide.ToLower() + " " : ""; ret += ActionType.Trim().Length > 0 ? ActionType.ToLower() + " " : ""; ret += SourcePart.Trim().Length > 0 ? SourcePart.ToLower() + " " : ""; ret += TransitionText.Trim().Length > 0 ? TransitionText.ToLower() + " " : ""; ret += DestSide.Trim().Length > 0 ? DestSide.ToLower() + " " : ""; ret += DestPart.Trim().Length > 0 ? DestPart.ToLower() + " " : ""; ret += SpecialText.Trim().Length > 0 ? SpecialText.ToLower() + " " : ""; return(ret); }
// Load one lvl void Start() { text.text = "NOP"; transit = this.GetComponent<TransitionText>(); // get GameObject tagged gameController gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>(); // define position based on light and camera currentPosition = new Vector3(environnement.position.x, environnement.position.y, environnement.position.z); // randomize the terrain /!\ This part is to complete to count the difficulty of lvl /!\ GameObject toInstantiate = terrain[Random.Range (0, terrain.Length)]; GameObject toInstantiate2 = terrain[Random.Range (0, terrain.Length)]; // instantiate the current lvl currentLvl = Instantiate (toInstantiate, currentPosition, Quaternion.identity) as GameObject; // if instantiate don't fail if (currentLvl != null) { // pos : position of the next lvl Vector3 pos = new Vector3(currentPosition.x + currentLvl.GetComponent<Collider>().bounds.size.x, currentPosition.y, currentPosition.z); // instantiate the next lvl at position "pos" nextLvl = Instantiate (toInstantiate2, pos, Quaternion.identity) as GameObject; // if instantiate don't fail : set all parent lvl to GameController if (nextLvl != null) { currentLvl.transform.SetParent(gameController.transform); nextLvl.transform.SetParent(gameController.transform); } else Debug.Log("Failed to instantiate the next lvl"); } else Debug.Log("Failed to instantiate the current lvl"); // at the beginning there is no preivous lvl previousLvl = null; }
void Awake() { transitionScreen = GetComponent <TransitionScreen>(); transitionText = GetComponent <TransitionText>(); }