void Start() { _collectionController = GameObject.FindGameObjectWithTag(Tag.GameController) .GetComponent <CollectionSystem>(); _controller = _collectionController.GetComponent <RepairController>(); _controller.RegisterRepair(this); }
void Start() { _controller = GameObject.FindGameObjectWithTag(SuriAlFuturo.Tag.GameController) .GetComponent <CollectionSystem>(); Sprite[] icons = Resources.LoadAll <Sprite>("Icons"); for (int i = 0; i < icons.Length; i++) { try { Collectable.Tag parsedTag = (Collectable.Tag)System.Enum.Parse(typeof(Collectable.Tag), icons[i].name); _icons[parsedTag] = icons[i]; } catch { Debug.LogWarning(icons[i].name + " has no enumerable on Collectable.Tag :("); } } for (int i = 0; i < Slots.Count; i++) { Slots[i].Index = i; } Refresh(); }
/* // Activate when debugging * void OnGUI() * { * if(GUI.Button(new Rect(100,100, 300,100), "GUARDAR DATOS")) { * SaveDataToDisk(); * } * * * if(GUI.Button(new Rect(100,200, 300,100), "CARGAR DATOS")) { * _LoadDataFromDisk(); * } * } */ public static void SaveDataToDisk( ) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/" + FileName); GameObject gc = GameObject.FindGameObjectWithTag(SuriAlFuturo.Tag.GameController); DialogueController dialogCtrl = gc.GetComponent <DialogueController>(); PersistenceController persistenceCtrl = gc.GetComponent <PersistenceController>(); CollectionSystem collectionSystem = gc.GetComponent <CollectionSystem>(); TapController tapCtrl = gc.GetComponent <TapController>(); TimeTravelController timeTravelCtrl = gc.GetComponent <TimeTravelController>(); EventController eventCtrl = gc.GetComponent <EventController>(); SavedGame savedGame = new SavedGame(); savedGame.Talkables = dialogCtrl.SavedTalkableStates; savedGame.GameObjects = persistenceCtrl.SavedGameObjects; savedGame.Collectables = collectionSystem.SavedCollectables; savedGame.Blockers = collectionSystem.SavedBlockers; savedGame.Inventory = collectionSystem.Inventory; savedGame.Taps = tapCtrl.SavedTaps; savedGame.CurrentReality = timeTravelCtrl.CurrentReality; savedGame.TouchTriggers = eventCtrl.SavedTouchTriggers; savedGame.TriggeredEvents = eventCtrl.TriggeredEvents; bf.Serialize(file, savedGame); file.Close(); }
void Start() { PersistenceKey = transform.position; _controller = GameObject.FindGameObjectWithTag(SuriAlFuturo.Tag.GameController) .GetComponent <CollectionSystem>(); _controller.Load(this); }
void Start() { _collectionSystem = GetComponent <CollectionSystem>(); _dialogueController = GetComponent <DialogueController>(); Screen.orientation = ScreenOrientation.LandscapeLeft; FollowingCamera.gameObject.SetActive(false); }
void Start() { PersistenceKey = transform.position; _gameController = GameObject.FindGameObjectWithTag(Tag.GameController) .GetComponent <GameController>(); _controller = _gameController.GetComponent <CollectionSystem>(); _navMeshObstacle = Obstacle.GetComponent <NavMeshObstacle>(); _animator = Model.GetComponent <Animator>(); _controller.Blockers.Add(this); _navMeshAgent = TheTalkable.GetComponent <NavMeshAgent>(); _navMeshAgent.enabled = false; _controller.Load(this); _canTake = false; }
private static void _LoadDataFromDisk() { string nombreArch = Application.persistentDataPath + "/" + FileName; GameObject gc = GameObject.FindGameObjectWithTag(SuriAlFuturo.Tag.GameController); DialogueController dialogCtrl = gc.GetComponent <DialogueController>(); PersistenceController persistenceCtrl = gc.GetComponent <PersistenceController>(); CollectionSystem collectionSystem = gc.GetComponent <CollectionSystem>(); TapController tapCtrl = gc.GetComponent <TapController>(); TimeTravelController timeTravelCtrl = gc.GetComponent <TimeTravelController>(); EventController eventCtrl = gc.GetComponent <EventController>(); if (File.Exists(nombreArch)) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(nombreArch, FileMode.Open); SavedGame savedGame = (SavedGame)bf.Deserialize(file); file.Close(); dialogCtrl.SavedTalkableStates = savedGame.Talkables; persistenceCtrl.SavedGameObjects = savedGame.GameObjects; collectionSystem.SavedCollectables = savedGame.Collectables; collectionSystem.SavedBlockers = savedGame.Blockers; collectionSystem.Inventory = savedGame.Inventory; tapCtrl.SavedTaps = savedGame.Taps; timeTravelCtrl.CurrentReality = savedGame.CurrentReality; eventCtrl.SavedTouchTriggers = savedGame.TouchTriggers; eventCtrl.TriggeredEvents = savedGame.TriggeredEvents; } else { SaveDataToDisk(); } }
void Start() { _collection = GameObject.FindGameObjectWithTag(SuriAlFuturo.Tag.GameController).GetComponent <CollectionSystem>(); }