void Awake() { if (_instance != null && _instance != this) { Destroy(gameObject); } _instance = this; }
void Start() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } board = GetComponent <TutorialBoardManager> (); InitGame(); }
/// <summary> /// Método Awake, que se ejecuta cuando carga el script /// </summary> void Awake() { // Se instancia a si misma if (instance == null) { instance = this; } else { Destroy(gameObject); return; } }
private void Awake() { instance = this; }
void Awake() { if (instance == null) instance = this; else if (instance != this) Destroy (gameObject); board = GetComponentInChildren<Board>(); aimers[0] = transform.FindChild("Aimer1").GetComponent<Aimer>(); aimers[1] = transform.FindChild("Aimer2").GetComponent<Aimer>(); }
public void setGameManager(TutorialGameManager manager) { _manager = manager; }
void Start() { Instance = this; GameObject[] holder = GameObject.FindGameObjectsWithTag("LinePlacement"); foreach (GameObject line in holder) { Line currentLine = line.GetComponent <Line>(); lineObjects.Add(currentLine); SpriteRenderer lineSprite = line.transform.parent.gameObject.GetComponent <SpriteRenderer>(); if (lineSprite.enabled) { currentLine.SetLineStatic(true); currentLine.SetOpen(false); } else { currentLine.SetLineStatic(false); currentLine.SetOpen(true); } } _Dynamic = GameObject.Find("_Dynamic"); //playerLine = (GameObject) Resources.Load("PlayerLine"); //computerLine = (GameObject) Resources.Load("ComputerLine"); lineGridScale = GameObject.Find("LineGrid").transform.localScale; canDraw = false; drawingTime = 0f; isTutorial01 = SceneManager.GetActiveScene().name.Contains("Tutorial01"); isTutorial02 = SceneManager.GetActiveScene().name.Contains("Tutorial02"); isTutorial03 = SceneManager.GetActiveScene().name.Contains("Tutorial03"); //placing = false; tutorialStep = 1; if (SceneManager.GetActiveScene().name.Contains("Tutorial01")) { isPassiveInstruction = false; isPlayerTurn = false; } else { isPassiveInstruction = true; isPlayerTurn = true; } passiveDismissDelay = 0; canUseBomb = false; //bombButton = GameObject.Find("BombButton"); //if (bombButton) bombButton.SetActive(false); if (isTutorial03) { bombToggle = GameObject.Find("BombToggle").GetComponent <Toggle>(); if (bombToggle) { bombToggle.gameObject.SetActive(false); } } if (!isTutorial01) { playerPoints = 0; playerPointsText = GameObject.Find("CurrentBoxesText").GetComponent <Text>(); Debug.Log("Found Player Points"); playerPointsText.text = "" + playerPoints; //minWinPoints = int.Parse(GameObject.Find("TotalBoxesText").GetComponent<Text>().text); totalPossiblePoints = GameObject.Find("LineGrid").transform.childCount; oneStarScore = (int)Mathf.Ceil(totalPossiblePoints * 0.3f); twoStarScore = (int)Mathf.Floor(totalPossiblePoints * 0.6f); threeStarScore = (int)Mathf.Floor(totalPossiblePoints * 0.85f); neededPointsText = GameObject.Find("TotalBoxesText").GetComponent <Text>(); neededPointsText.text = "" + oneStarScore; } }