private void OnEnable() { _hudController = FindObjectOfType <HudController>(); _audioSource = GetComponent <AudioSource>(); HudController.resumeAfterCrash += PlaySmokeParticles; HudController.resumeAfterCrash += StartMove; }
// // Tries to grab necessary components if they haven't been already. // // Returns true if all components were verified to be grabbed. // private bool TryToGrabComponents() // { // if (this.matchDataBroadcaster == null) // this.matchDataBroadcaster = FindObjectOfType<MatchDataBroadcaster>(); // if (this.matchController == null) // this.matchController = FindObjectOfType<MatchController>(); // if (this.matchDataBroadcaster == null) // return false; // if (this.matchController == null) // return false; // return true; // } private IEnumerator GrabComponentsCoroutine() { while (this.matchDataBroadcaster == null) { this.matchDataBroadcaster = FindObjectOfType <MatchDataBroadcaster>(); yield return(null); } while (this.matchController == null) { this.matchController = FindObjectOfType <MatchController>(); yield return(null); } while (this.gridController == null) { this.gridController = FindObjectOfType <GridController>(); yield return(null); } while (this.hudController == null) { this.hudController = FindObjectOfType <HudController>(); yield return(null); } }
private void Awake() { if (instance == null) { instance = this; } }
// Start is called before the first frame update void Start() { player = FindObjectOfType <PlayerController>(); screenBounds = GetScreenBounds(); hudController = FindObjectOfType <HudController>(); StartCoroutine(SpawnEnemies()); }
//-----------------------------------------------WEAPON FUNCTIONS-------------------------------------// public virtual void Start() { inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory>(); hud = GameObject.FindGameObjectWithTag("HUD").GetComponent <HudController>(); audioSource = GetComponent <AudioSource>(); roundsInClip = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>().LoadLastClip; // load last clip into new clip isReloading = false; }
void Awake() { hudController = GameObject.FindGameObjectWithTag("manager").GetComponent <HudController>(); if (MainMenuController.players < 2 && playerNumber == 2) { gameObject.SetActive(false); } }
void Awake() { if (instance != null) { Destroy(gameObject); } instance = this; }
private void Awake() { if (instance != null) { return; } instance = this; }
void Start() { if (instance) { Debug.LogError("More than one hud controller"); return; } instance = this; }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { HudController HUD = GameObject.FindObjectOfType <HudController>(); if (HUD != null) { Camera.main.backgroundColor = Color.Lerp(FadeStartColor, FadeEndColor, stateInfo.normalizedTime); } }
public static void Init(MapModel mapModel) { MapController = new MapController(mapModel, Refs.Instance.MapView); HudController = new HudController(Refs.Instance.HudView); PopupPanelController = new PopupPanelController(Refs.Instance.PopupPanelView); // Special Keys BindKey(KeyCode.Escape, Application.Quit); // [Escape] - Quit }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { HudController HUD = GameObject.FindObjectOfType <HudController>(); if (HUD != null) { FadeStartColor = Color.Lerp(GoodColor, BadColor, (float)HUD.enemiesCounter / (float)HUD.startingEnemies); FadeEndColor = Color.Lerp(GoodColor, BadColor, (float)(HUD.enemiesCounter - 1) / (float)HUD.startingEnemies); } }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { AudioManager.PlaySound(SFX.Dead); HudController HUD = GameObject.FindObjectOfType <HudController>(); if (HUD != null) { HUD.GameOver(false); } }
private void Awake() { if (current == null) { current = this; } cardAzul.SetActive(false); cardVerde.SetActive(false); cardNaranja.SetActive(false); }
protected bool AcquireOccupation(CareerManager ths, AcquireOccupationParameters occupationParameters) { Occupation occupation; Sim createdSim = ths.mSimDescription.CreatedSim; CareerLocation location = occupationParameters.Location; OccupationNames newJobGuid = occupationParameters.TargetJob; if ((ths.mJob != null) && (location != null) && (ths.mJob.Guid == location.Career.Guid) && (ths.mJob.CareerLoc != location)) { Career mJob = ths.mJob as Career; if ((mJob != null) && (mJob.TransferBetweenCareerLocations(location, false))) { IncStat("Transferred"); return(true); } } if (!ths.TryGetNewCareer(newJobGuid, out occupation)) { IncStat("TryGetNewCareer Fail"); return(false); } if (ths.mJob != null) { if (createdSim != null) { EventTracker.SendEvent(new TransferCareerEvent(createdSim, ths.mJob, occupation)); } ths.mJob.LeaveJob(false, Career.LeaveJobReason.kTransfered); } EventTracker.SendEvent(EventTypeId.kCareerNewJob, createdSim); occupation.OwnerDescription = ths.mSimDescription; occupation.mDateHired = SimClock.CurrentTime(); occupation.mAgeWhenJobFirstStarted = ths.mSimDescription.Age; occupation.SetAttributesForNewJob(location, occupationParameters.LotId, occupationParameters.CharacterImportRequest); EventTracker.SendEvent(new CareerEvent(EventTypeId.kEventCareerHired, occupation)); EventTracker.SendEvent(new CareerEvent(EventTypeId.kEventCareerChanged, occupation)); EventTracker.SendEvent(new CareerEvent(EventTypeId.kCareerDataChanged, occupation)); occupation.RefreshMapTagForOccupation(); ths.UpdateCareerUI(); if ((createdSim != null) && createdSim.IsActiveSim) { HudController.SetInfoState(InfoState.Career); } IncStat("Job Acquired " + occupation.Guid); return(true); }
// Use this for initialization void Awake() { // First we check if there are any other instances conflicting if (instance != null && instance != this) { // If that is the case, we destroy other instances Destroy(gameObject); } // Here we save our singleton instance instance = this; // Furthermore we make sure that we don't destroy between scenes (this is optional) DontDestroyOnLoad(gameObject); }
private void Start() { _hudController = FindObjectOfType <HudController>(); _hudController.SetCurrentAction("--", "--"); _hudController.SetSimulationStatus(SimStatus.None); _planSolver = GetComponent <PlanSolver>(); // SET holders game objects in scene SetHolders(); // SETUP SIMULATION WITH SETTINGS SetupSimulation(); // START SIMULATION ROUTINES StartCoroutine(SimulatePlan()); }
public void setPlayer(GameObject p) { player = p.transform.Find("Player"); player.gameObject.GetComponent <PlayerController>().level = this; player.gameObject.GetComponent <PlayerController>().inHub = false; if (player.gameObject.GetComponent <PlayerController>().weapon != null) { player.gameObject.GetComponent <PlayerController>().weapon.gameObject.GetComponent <WeaponInfo>().level = this; } playerCamInternal = p.transform; hud = playerCamInternal.Find("Canvas").gameObject.GetComponent <HudController>(); hud.inhub = false; hud.level = this; hud.enemyParent = enemiesParent; }
private void Awake() { instance = this; _waveTimeRemaining = _timeBetweenWave; hudController = GameObject.FindObjectOfType <HudController>(); enemiesParent = GameObject.Find("Enemies").transform; spawners = GameObject.FindGameObjectsWithTag("Spawner"); Time.timeScale = 1; ResetTimers(); }
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { GameObject.Destroy(animator.gameObject); HudController HUD = GameObject.FindObjectOfType <HudController>(); if (HUD != null) { HUD.KillEnemy(); // Check if you won if (HUD.enemiesCounter == 0) { HUD.GameOver(true); } } }
// Setup singleton and initialize what needs to be public void Start() { // set up singleton instance if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); // Initialize values this.insistanceTexts = new Dictionary <InsistanceType, Text>(); this.mode = Mode.Select; }
private void setClasses() { inputManager = gameObject.GetComponent <InputManager>(); dataHolder = gameObject.GetComponent <DataHolder>(); selectionManager = gameObject.GetComponent <SelectionManager>(); prefabManager = gameObject.GetComponent <PrefabManager>(); hudController = gameObject.GetComponent <HudController>(); cursorManager = gameObject.GetComponent <CursorManager>(); resourceManager = gameObject.GetComponent <ResourceManager>(); randomResourceSpawner = gameObject.GetComponent <RandomResourceSpawner>(); popupController = gameObject.GetComponent <PopupController>(); characterUiManager = gameObject.GetComponent <CharacterUiManager>(); winManager = gameObject.GetComponent <WinManager>(); graveyardManager = gameObject.GetComponent <GraveyardManager>(); tipManager = gameObject.GetComponent <TipManager>(); soundManager = gameObject.GetComponent <SoundManager>(); }
public void setPlayer(GameObject p) { playerCam = p.transform; player = p.transform.Find("Player").GetComponent <PlayerController>(); player.gameObject.GetComponent <PlayerController>().level = null; player.gameObject.GetComponent <PlayerController>().inHub = true; player.gameObject.GetComponent <PlayerController>().resetPlayer(); player.gameObject.GetComponent <PlayerController>().hub = this; if (player.gameObject.GetComponent <PlayerController>().weapon != null) { player.gameObject.GetComponent <PlayerController>().weapon.gameObject.GetComponent <WeaponInfo>().inHub = false; player.gameObject.GetComponent <PlayerController>().weapon.gameObject.GetComponent <WeaponInfo>().hub = this; } HudController hud = playerCam.transform.Find("Canvas").GetComponent <HudController>(); hud.inhub = true; hud.hub = this; }
protected virtual void Awake() { if (lockMouseOnPlay) { ChangeMouseLockState(1); } ; if (GameObject.FindGameObjectWithTag("GameController")) { gameManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>(); playerManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <PlayerManager>(); } if (GameObject.FindGameObjectWithTag("Hud")) { hud = GameObject.FindGameObjectWithTag("Hud").GetComponent <HudController>(); } }
protected override void OnEnter() { Board.Instance.gameObject.SetActive(true); this.scenario.Initialize(); this.navigationViewController = Container.Instance.Instantiate <NavigationViewController>(); this.navigationViewController.Initialize(); this.scenarioViewController = Container.Instance.Instantiate <ScenarioViewController>(new[] { this.scenario }); this.scenarioViewController.Initialize(); this.hudController = Container.Instance.Instantiate <HudController>(); this.hudController.Initialize(); var health = this.character.Entity.GetComponent <HealthComponent>(); health.Health = health.HealthMax; }
private void Awake() { // Singleton setup for GameManager if (Instance == null) { //DontDestroyOnLoad(gameObject); // comment out singleton to goto menu Instance = this; } else if (Instance != this) { Destroy(gameObject); } PlayerController = GetComponent <PlayerController>(); MoneyController = GetComponent <MoneyController>(); CorporationController = GetComponent <CorporationController>(); TileController = GetComponent <TileController>(); BoardController = GetComponent <BoardController>(); HudController = GetComponent <HudController>(); MainMenuController = GetComponent <MainMenuController>(); }
public void OnHeroActorCreated(HeroActor actor, bool isFriend) { // 创建一个血条 LoadModule.LoadUI(path, delegate(AssetRequest data) { GameObject asset = data.asset as GameObject; GameObject go = Object.Instantiate(asset); go.transform.SetParent(parentNode); go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; GameObject heroGO = actor.gameObject; HudController hudController = go.GetComponent <HudController>(); Transform targetTransform = heroGO.transform.Find("Dummy OverHead"); hudController.Init(canvasTransform, targetTransform, uiCamera, 0, isFriend); HudActor hudActor = new HudActor(go, hudController); float hpPercent = actor.battleEntity.GetHPPercent(); hudActor.SetValue(hpPercent); m_actorMap.Add(actor.id, hudActor); }); }
protected override void InitGame() { doingSetup = true; //////// GAME - BEGIN GameData gameData = (GameData)GetGameData(); health = gameData.GetHealth(); points = gameData.GetPoints(); //////// GAME - END levelController = (LevelController)FindObjectOfType(typeof(LevelController)); hudController = levelController.getHudController(); //////// GAME - BEGIN hudController.SetLives(lives); hudController.SetPoints(points); hudController.InitLifebar(health, gameData.GetInitialHealth()); //////// GAME - END startDelay = levelController.InitLevel(); Invoke("StartLevel", startDelay); }
void Awake() { instance = this; cam = Camera.main.GetComponent <CameraController>(); cam.target = transform; sr = GetComponent <SpriteRenderer>(); rb = GetComponent <Rigidbody2D>(); col = GetComponent <BoxCollider2D>(); anim = GetComponent <Animator>(); source = GetComponent <AudioSource>(); knifeSr = transform.GetChild(0).GetComponent <SpriteRenderer>(); hud = HudController.instance; shield = transform.GetChild(1).gameObject; shieldCol = shield.GetComponent <BoxCollider2D>(); focusParticles = transform.GetChild(2).gameObject; js = JumpingStates.None; health = MAX_HEALTH; enemyMask = 1 << LayerMask.NameToLayer("Enemy"); areaCheck = new Vector2(.1f, HEIGHT - .1f); facingRight = true; attackable = true; active = true; }
// The crafting function public bool craft(ItemRecipie details, GameObject item) { PlayerController controller = player.GetComponent <PlayerController>(); // Get player resource counts and subtract from requirement amount int ingredient1 = controller.getResourceAmount((int)details.item_ingredient1) - details.item_ingredient1_count; int ingredient2 = controller.getResourceAmount((int)details.item_ingredient2) - details.item_ingredient2_count; int ingredient3 = controller.getResourceAmount((int)details.item_ingredient3) - details.item_ingredient3_count; // If any one of the counts is negative, crafting is not possible if (ingredient1 >= 0 && ingredient2 >= 0 && ingredient3 >= 0) { // Add the item to the inventory according to the yield amount for (int i = 0; i < details.item_yield_amount; i++) { controller.inventory.addItem(item.GetComponent <Item>()); } // Subtract the resources from the player counts controller.subtractResourceAmount((int)details.item_ingredient1, details.item_ingredient1_count); controller.subtractResourceAmount((int)details.item_ingredient2, details.item_ingredient2_count); controller.subtractResourceAmount((int)details.item_ingredient3, details.item_ingredient3_count); // If the item crafted is ammo and the same type as weapon held, update the HUD counter if (details.item_type == ItemType.AMMO && details.item.GetComponent <Item>().ammo_type == controller.getWeapon.GetComponentInChildren <Weapon>().getAmmoType) { Weapon weaponHeld = controller.getWeapon.GetComponentInChildren <Weapon>(); HudController hud = GameObject.FindGameObjectWithTag("HUD").GetComponent <HudController>(); weaponHeld.updateAmmoCounts(weaponHeld.RoundsInClip, weaponHeld.TotalRounds + details.item_yield_amount); hud.updateAmmoText(weaponHeld.RoundsInClip, weaponHeld.TotalRounds); } return(true); } else { return(false); } }
private void Start() { hud = GetComponentInChildren<HudController>(); isSettingConstructionPoint = false; }
void Start() { speechManager = GameObject.FindWithTag("kinect-speech").GetComponent<SpeechManager>(); intManager = GameObject.FindWithTag("kinect-interaction").GetComponent<InteractionManager>(); hud = GameObject.FindWithTag("hud").GetComponent<HudController>(); }
void Start() { playerState = (PlayerState)PlayerPrefs.GetInt("playerState"); changePlayer = true; anim = GetComponent<Animator>(); coins = PlayerPrefs.GetInt("playerCoins"); lives = PlayerPrefs.GetInt("playerLives"); hud = GameObject.FindWithTag("hud").GetComponent<HudController>(); charController = GetComponent<CharacterController>(); }