// Use this for initialization private void Start() { worldController = WorldController.instance; baseBodyScaleX = bodyTransform.localScale.x; baseBodyScaleZ = bodyTransform.localScale.z; }
public static WorldController getInstance() { if (instance == null) { instance = new WorldController(); } return instance; }
private void Awake() { if (instance == null) instance = this; else if (instance != this) { Debug.LogError("Tried to created another instance of " + GetType() + ". Destroying."); Destroy(gameObject); } }
// Use this for initialization void Start() { instance = this; roomScript = GetComponent<RoomManager>(); InitGame(); this.player = PlayerController.instance; this.camera = CameraController.instance; this.roomWidth = this.roomScript.columns; this.roomHeight = this.roomScript.rows; this.numRooms = this.roomScript.roomSide; }
void Awake() { streak = 0; _previousTrigger = 0; _playerState = PlayerState.Inactive; _inputController = InputController.Instance; _rhythmController = RhythmController.Instance; _worldController = WorldController.Instance; _soundManager = SoundManager.Instance; _config = Config.Instance; _scoreController = ScoreController.Instance; _menuController = MenuController.Instance; _titleController = TitleController.Instance; feedbackAnim = GameObject.Find ("Feedbacks/Feedback" + index).GetComponent<Animator>(); }
// Use this for initialization void Start() { world = new World(); _instance = this; //Create game object for each tile for (int x = 0; x < world.Width; x++) { for (int y = 0; y < world.Height; y++) { GameObject tile_go = new GameObject (); Tile tile_data = world.getTileAt (x, y); tile_go.name = "Tile_" + x + "_" + y; tile_go.transform.position = new Vector3 (tile_data.X, tile_data.Y, 0); tile_go.transform.SetParent (this.transform, true); tile_go.AddComponent<SpriteRenderer> (); tile_data.RegisterTileTypeChangedCB ( (tile) => { onTileTypeChanged(tile, tile_go);}); } } world.RandomizeTiles(); }
IEnumerator Start() { InitGlobal(); InitWorld(); InitUI(); //проверка все ли есть на сцене if (Terrain.activeTerrain==null) { ui.error("ErrorCreateMap", "Terrain"); yield break; } else if (cam==null) { ui.error("ErrorCreateMap", "Camera"); yield break; } else if (scene==null) { ui.error("ErrorCreateMap", "Scene"); yield break; } //инициализация компонентов мира map = scene.AddComponent<Map>(); players = scene.AddComponent<Players>(); effects = scene.AddComponent<MapEffects>(); controller = scene.AddComponent<WorldController>(); //передача в players tiles map.EventDataTiles += delegate(MapDataGround.Tile[,] data) { players.tiles = data; }; //передача в players zones map.EventDataZones += delegate(byte[,] data) { players.zones = data; }; //подпрограммы инциализаций компонентов yield return StartCoroutine(map.Init()); yield return StartCoroutine(players.Init()); yield return StartCoroutine(effects.Init()); yield return StartCoroutine(controller.Init()); CreateMe(); yield break; }
void Awake() { wc = GameObject.FindGameObjectWithTag("GameController").GetComponent<WorldController>(); rb = gameObject.GetComponent<Rigidbody2D>(); }
void init () { Instance = this; //TODO: Insert initialization/world loading code here getGameProgress(); }
// Use this for initialization private void Start() { worldController = FindObjectOfType<WorldController>(); worldTimeController = FindObjectOfType<WorldTimeController>(); }
void Awake() { worldController = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<WorldController> (); }
void Awake() { singleton = this; }
void OnDestroy() { singleton = null; }
void Awake() { instance = this; player = FindObjectOfType<PlayerController>(); }