//Will print an examepl of use of the localization system. void Awake() { #if UNITY_EDITOR savedData = AssetDatabase.LoadAssetAtPath<SavedData>(SAVE_PATH); if (savedData == null) { savedData = ScriptableObject.CreateInstance<SavedData> (); AssetDatabase.CreateAsset (savedData, SAVE_PATH); } #endif if (g_instance == null) { g_instance = this; } else { Debug.Log("Localizater already initialized... Destroying duplicate."); } DontDestroyOnLoad(this.gameObject); #if UNITY_EDITOR Debug.Log("Attempt at translating unrecognized word: " + IDToWord("StartMessage")); #endif }
void Start() { // Get my localization gameobject on the scene. loc = Localizater.FindObjectOfType <Localizater>(); // Get the text component. text = GetComponent <Text>(); // Determine which tag is associated and write the correct text. switch (text.tag) { // Each case calls a function listed below. case startButton: StartButton("Start"); break; case quitButton: QuitButton("Quit"); break; case replayButton: ReplayButton("Replay"); break; default: break; } }
void OnTriggerStay2D(Collider2D coll) { if (Input.GetKeyDown("space")) { dialogueBox = GameObject.Find ("HUD(Clone)").GetComponentInChildren<DialogueScript>(); localizater = GameObject.Find ("LanguageManager").GetComponent<Localizater>(); if (gameObject.tag == "LeftArmor") { dialogueBox.NewText (localizater.IDToWord("LEFT")); } else if (gameObject.tag == "RightArmor") { dialogueBox.NewText (localizater.IDToWord("RIGHT")); } else if (gameObject.tag == "TopArmor") { dialogueBox.NewText (localizater.IDToWord("LAST")); } } }
void Start() { // Get my localization gameobject on the scene. loc = Localizater.FindObjectOfType<Localizater>(); // Get the text component. text = GetComponent<Text>(); // Determine which tag is associated and write the correct text. switch(text.tag) { // Each case calls a function listed below. case startButton: StartButton("Start"); break; case quitButton: QuitButton("Quit"); break; case replayButton: ReplayButton("Replay"); break; default: break; } }
private void Start() { //Initialize components. anim = GetComponent<Animator> (); rb = GetComponent<Rigidbody2D> (); rend = GetComponent<Renderer> (); localizater = GameObject.Find ("LanguageManager").GetComponent<Localizater>(); //Initialize audio. var aSources = GetComponents<AudioSource> (); aus1 = aSources [0]; aus2 = aSources [1]; aus3 = aSources [2]; aus4 = aSources [3]; //Setting player variables. speed = 1f; playerDisabled = false; playerInvincible = false; knockbackForce = 100f; purityEnabled = true; isWhirlwind = false; nextLevel = 20; strength = 1; silverKey = false; goldKey = false; grassCut = 0; completedPuzzles = 0; //First dialogue of the game. DialogueScript.dialogue = localizater.IDToWord ("FIRST"); //***Preprocessors if using debug mode. Allows to one-shot enemies and skip both puzzles. #if DEBUG silverKey = true; goldKey = true; strength = 10; #endif }
// Insufficient time to use this class // Use this for initialization void Awake() { localizer = GetComponent<Localizater>(); }