public override void createButtons(GameObject buttonPrefab, Texture jump, Texture attack) { sizeFixer = new SizeFixer(); float x = 200.0f; float y = 80.0f; float width = 140.0f; float height = 140.0f; GameObject button = (GameObject)Instantiate(buttonPrefab, buttonPrefab.transform.position, buttonPrefab.transform.rotation); Button buttonScript = button.GetComponent <Button>(); buttonScript.initializeVariables("JUMP", sizeFixer.getRectFixResolution(x, y, width, height), jump); listButtons.Add(buttonScript); x = 1850.0f; y = 80.0f; width = 140.0f; height = 140.0f; button = (GameObject)Instantiate(buttonPrefab, buttonPrefab.transform.position, buttonPrefab.transform.rotation); buttonScript = button.GetComponent <Button>(); buttonScript.initializeVariables("ATTACK", sizeFixer.getRectFixResolution(x, y, width, height), attack); listButtons.Add(buttonScript); }
void Start() { inputMapping = new InputMapping(); levelsAttributes = new LevelsAttributes(); sceneID = LevelsAttributes.currentLevelId; #if UNITY_ANDROID inputMapping.idController = "Android"; instantiatePlayer(sceneID, PlayerCharacter.GHOST, levelsAttributes.getInitialPositionFromID(sceneID), inputMapping.idController, getKeysBasedOnController(inputMapping.idController)); CustomGUI gui = GameObject.Find("CustomGUI").GetComponent <CustomGUI>(); gui.initializeButtonsAndroid(); #endif #if UNITY_STANDALONE_WIN || UNITY_WEBPLAYER string idController = inputMapping.idController; instantiatePlayer(sceneID, PlayerCharacter.GHOST, levelsAttributes.getInitialPositionFromID(sceneID), idController, getKeysBasedOnController(idController)); #endif SizeFixer sizeFixer = new SizeFixer(); namePlayer = sizeFixer.getRectFixResolution(1900, 20, 300, 200); coinsRect = sizeFixer.getRectFixResolution(1600, 20, 100, 50); nameStyle = new GUIStyle(); nameStyle.fontSize = 17; }
public override void createButtons(GameObject buttonPrefab, Texture jump, Texture attack) { sizeFixer = new SizeFixer(); float x = 200.0f; float y = 80.0f; float width = 140.0f; float height = 140.0f; GameObject button = (GameObject)Instantiate(buttonPrefab, buttonPrefab.transform.position, buttonPrefab.transform.rotation); Button buttonScript = button.GetComponent<Button>(); buttonScript.initializeVariables("JUMP", sizeFixer.getRectFixResolution(x, y, width, height), jump); listButtons.Add(buttonScript); x = 1850.0f; y = 80.0f; width = 140.0f; height = 140.0f; button = (GameObject)Instantiate(buttonPrefab, buttonPrefab.transform.position, buttonPrefab.transform.rotation); buttonScript = button.GetComponent<Button>(); buttonScript.initializeVariables("ATTACK", sizeFixer.getRectFixResolution(x, y, width, height), attack); listButtons.Add(buttonScript); }