private Boolean SetHUDState(HUDState newState) { if (newState != State) { ArduinoInterface.Clear(); State = newState; switch (State) { case HUDState.Wasted: ArduinoInterface.Print("WASTED"); break; case HUDState.Busted: ArduinoInterface.Print("BUSTED"); break; case HUDState.InfoCycle: GoToCycle(Game.Player.Character.IsInVehicle() ? HUDCycle.VehicleSpeed : HUDCycle.WorldInfo, true); break; } return(true); } return(false); }
public void ChangeHudState(HUDState newState) { SetPanelActive(_currentHudState, false); _currentHudState = newState; SetPanelActive(_currentHudState, true); OnHudStateChanged(newState); }
void Build(BuildableObject obj) { if (hudState != HUDState.BASE) { return; } BuildableObject planner = Instantiate(obj) as BuildableObject; // Will position itself automatically Debug.Log(obj.m_costToBuild.ToString()); if (!SummonerInventory.Instance.checkResourcesAvailable(planner.m_costToBuild)) { Destroy(planner.gameObject); return; } hudState = HUDState.BUILD; if (!mouse.BeginBuild(planner)) { Destroy(planner.gameObject); ResetHUDState(); return; } RefreshHUDSDisplay(); }
public void ResetHUDState() { mouse.EndBuild(); hudState = HUDState.BASE; hudText.text = ""; RefreshHUDSDisplay(); }
private void OnHudStateChanged(HUDState newState) { switch (newState) { case HUDState.HS_GAME: ResetHudState(); LivesController.ResetLifes(); _statsController.Show(false); break; case HUDState.HS_PAUSE: UpdateShipStatsGUI(); _statsController.Show(true); break; case HUDState.HS_WIN: UpdateShipStatsGUI(); _statsController.Show(true); break; case HUDState.HS_LOST: UpdateShipStatsGUI(); _statsController.Show(true); break; } }
// Co-rutinas de animacion // Para administrar mejor las animaciones, por comodidad, limpieza de codigo, y facilidad de lectura, utilizo co-rutinas // ======================================================================================================================== IEnumerator OpenAnim_unitInfo() { if (interactable) { unitPanel_CG.gameObject.SetActive(true); unitActions_CG.gameObject.SetActive(true); highlightFlash.alpha = 0; highlightFlash.transform.localScale = Vector3.one; StopCoroutine("UnitCommandsHighlightFlash"); StartCoroutine("UnitCommandsHighlightFlash"); currentHudState = HUDState.unitSelected; animationInProgress = true; float t = 0; float animSpeed = 6f; while (t < 1) { t = Mathf.MoveTowards(t, 1, Time.deltaTime * animSpeed * ((1 - t) + 0.05f)); unitPanel_CG.alpha = t; unitPanel_ColouredDeco.transform.localPosition = initPos_unitInfo_colouredDeco + Vector3.left * 100f * (1 - t); unitPanel_NameShade.transform.localRotation = Quaternion.Euler(0, 0, ((1 - t) * 100) + 45); unitPanel_NameShade.transform.localPosition = initPos_unitInfo_nameShade + Vector3.left * 400f * (1 - t); unitPanel_ColouredDeco.transform.localRotation = Quaternion.Euler(0, 0, (1 - t) * 600); unitActions_CG.alpha = t; unitActions_Name.transform.localPosition = initPos_unitActions_name + Vector3.down * 400 * (1 - t); unitActions_Panel.transform.localPosition = initPos_unitActions_panel + Vector3.right * 200 * (1 - t); yield return(null); } animationInProgress = false; } }
public void OpenChest(Storage left, Storage right) { var inventory = new ChestOpen(_game); inventory.BuildItems(left, right); _ui = inventory; _state = HUDState.Inventory2; }
public void Update() { if (!triggered) { return; } PlayerInventoryBase.SetFlashlightEnabled(FlashlightEnabled, false, false); switch (state) { case HUDState.FlickerOff: Flicker(10, false, 0.5f, 0.8f); EEAGlobalState.IsPlayerEMP = true; state = HUDState.ForceOffDelay; stateTimer = Clock.Time + 5f; GuiManager.NavMarkerLayer.m_visible = false; break; case HUDState.ForceOffDelay: if (stateTimer < Clock.Time) { state = HUDState.ForceOff; stateTimer = Clock.Time + Duration; } break; case HUDState.ForceOff: GuiManager.PlayerLayer.SetVisible(false); FlashlightEnabled = false; if (stateTimer > Clock.Time) { state = HUDState.FlickerOn; } break; case HUDState.FlickerOn: GuiManager.PlayerLayer.SetVisible(true); GuiManager.PlayerLayer.Inventory.SetVisible(false); GuiManager.PlayerLayer.m_compass.SetVisible(false); GuiManager.PlayerLayer.m_wardenObjective.SetVisible(false); GuiManager.PlayerLayer.m_playerStatus.SetVisible(false); GuiManager.PlayerLayer.m_gameEventLog.SetVisible(false); GuiManager.NavMarkerLayer.m_visible = true; Flicker(20, true); state = HUDState.End; stateTimer = Clock.Time + Duration - FlashDuration; break; case HUDState.End: if (stateTimer < Clock.Time) { Destroy(this); EEAGlobalState.IsPlayerEMP = false; } break; } }
private void SetPanelActive(HUDState state, bool active) { int index = (int)state; if (index >= 0 && index < _hudStateInfoCount) { _hudStateInfos[index].panel.SetActive(active); } }
public void CloseUnitInfo() { if (!(currentHudState == HUDState.unitSelected)) { return; } unitPanelSelected.DeSelect(); unitPanelSelected = null; currentHudState = HUDState.nothingSelected; StartCoroutine("CloseAnim_unitInfo"); StopCoroutine("OpenAnim_unitInfo"); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); InitServices(); LoadLevel(false); defaultHUD = new DefaultHUDState(); inventoryHUD = new InventoryHUDState(Player.Inventory); charHUD = new CharHUDState(); editorHUD = new EditorHUDState(); HUDState = defaultHUD; }
void Awake() { managerInterfaz = IngameInterfaceManager.currentInstance; estado = HUDState.nothingSelected; currentInstance = this; /* botonAtck = GameObject.Find("ButtonAttack"); * botonMove = GameObject.Find("ButtonMove"); * botonConstr = GameObject.Find("ButtonBuild"); * botonCrearUn = GameObject.Find("ButtonCreateUnit");*/ }
public void Simulate(GameTime gameTime) { float time_scale = 60.0f / 1000; float dt = time_scale * (float)gameTime.ElapsedGameTime.Milliseconds; MainScene.ProcessSubsystems(dt); // TODO: include this as a subsystem var drawable = (TileMapRenderComponent)MainScene.TileMap; drawable.RebuildBuffers(); HUDState.Tick(); }
void OpenActionInProgress(ActionInProgressMode mode) { if (interactable) { if (currentHudState != HUDState.unitSelected) { return; } if (animationInProgress) { return; } StopCoroutine("OpenAnim_actionInProgress"); StartCoroutine("OpenAnim_actionInProgress"); switch (mode) { case ActionInProgressMode.move: { actionInProgress_info.text = "Select a destination"; break; } case ActionInProgressMode.attack: { actionInProgress_info.text = "Select a target"; break; } case ActionInProgressMode.build: { actionInProgress_info.text = "Select a place to build"; break; } case ActionInProgressMode.gather: { actionInProgress_info.text = "Select a resource"; break; } case ActionInProgressMode.create: { actionInProgress_info.text = "Select where to create unit"; break; } } currentHudState = HUDState.actionSelected; //print(currentHudState); StopCoroutine("CloseAnim_unitInfo"); StartCoroutine("CloseAnim_unitInfo"); } }
// Use this for initialization void Start() { fadeIn = false; fadeOut = true; slider = GetComponentInChildren <Slider>(); playerController = FindObjectOfType <PlayerController>(); gameController = FindObjectOfType <GameController>(); buildingManager = FindObjectOfType <BuildingManager>(); globalHealth.maxValue = buildingManager.globalCasualtyMax; hudState = HUDState.Active; gameController.hudController = this; AddBuildingsToTracker(); }
private void ResetHudState() { _currentHudState = HUDState.HS_GAME; SetActivePositionToIsland(); //UpdateActiveGUI(ActiveSkillsEnum.Buoy, 1f); //UpdateActiveGUI(ActiveSkillsEnum.SecondLight, 1f); //UpdateActiveGUI(ActiveSkillsEnum.Flare, 1f); //UpdateActiveGUI(ActiveSkillsEnum.Freeze, 1f); for (int i = 0; i < _hudStateInfoCount; ++i) { HUDState tmpState = (HUDState)i; SetPanelActive(tmpState, tmpState == _currentHudState); } HideActiveSkills(); _statsController.Show(false); }
private void SwitchToState(HUDState newState) { switch (newState) { case HUDState.Alive: AliveContainer.SetActive(true); DeathContainer.SetActive(false); break; case HUDState.Dead: default: AliveContainer.SetActive(false); DeathContainer.SetActive(true); break; } }
public void OpenInventory(Entity entity) { IsMouseOnHud = false; var inventory = new InventoryOpen(_game); var storage = entity.Get <Storage>(); if (storage == null) { Debug.WriteLine("_warn_ HUDContext.cs 47"); return; } inventory.BuildItems(storage); _ui = inventory; _state = HUDState.Inventory1; }
void updateHUDFor(Player player, HUDState state, string message = null) { int playerIndex = players.IndexOf(player); SKSpriteNode avatar = hudAvatars [playerIndex]; avatar.RunAction(SKAction.Sequence(new [] { SKAction.FadeAlphaTo(1f, 1), SKAction.FadeAlphaTo(0.2f, 1), SKAction.FadeAlphaTo(1f, 1) })); SKLabelNode label = hudLabels [playerIndex]; float heartAlpha = 1f; switch (state) { case HUDState.Local: label.Text = "ME"; break; case HUDState.Connecting: heartAlpha = 0.25f; label.Text = message ?? "AVAILABLE"; break; case HUDState.Disconnected: avatar.Alpha = 0.5f; heartAlpha = 0.1f; label.Text = "NO PLAYER"; break; case HUDState.Connected: label.Text = message ?? "CONNECTED"; break; default: throw new NotImplementedException(); } for (int i = 0; i < player.LivesLeft; i++) { SKSpriteNode heart = hudLifeHeartArrays [playerIndex] [i]; heart.Alpha = heartAlpha; } }
private void changeState() { switch (stateHUD) { case HUDState.FlightState: stateHUD = HUDState.FightState; print("fightMode"); HUDChanger.changeHUD(stateHUD); break; case HUDState.FightState: stateHUD = HUDState.FlightState; print("flightMode"); HUDChanger.changeHUD(stateHUD); break; } }
public void CloseActionInProgress() { if (currentHudState != HUDState.actionSelected) { return; } if (animationInProgress) { return; } StopCoroutine("CloseAnim_actionInProgress"); StartCoroutine("CloseAnim_actionInProgress"); StopCoroutine("CloseAnim_unitInfo"); StopCoroutine("OpenAnim_unitInfo"); StartCoroutine("OpenAnim_unitInfo"); currentHudState = HUDState.unitSelected; }
public void ResetDuration(float newDuration) { Duration = newDuration; foreach (var item in coroutines) { EEA_MelonCoroutines.Stop(item as IEnumerator); } coroutines.Clear(); if (state == HUDState.FlickerOn) { stateTimer = Clock.Time + FlashDuration; } if (state == HUDState.End) { state = HUDState.FlickerOff; } }
private Boolean SetHUDState(HUDState newState) { if (newState != state) { ArduinoInterface.Clear(); Timer = 0; state = newState; switch (state) { case HUDState.Wasted: ArduinoInterface.Print("WASTED"); break; case HUDState.PlayerHealth: PlayerHealth = -1; PlayerArmor = -1; ArduinoInterface.SetCursor(0, 0); ArduinoInterface.Print("Health: 0%"); ArduinoInterface.SetCursor(0, 1); ArduinoInterface.Print(" Armor: 0%"); break; case HUDState.VehicleHealth: VehicleBodyHealth = -1; VehicleEngineHealth = -1; ArduinoInterface.SetCursor(0, 0); ArduinoInterface.Print(" Body: 0%"); ArduinoInterface.SetCursor(0, 1); ArduinoInterface.Print("Engine: 0%"); break; } return(true); } return(false); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (Keyboard.GetState().IsKeyDown(Keys.LeftAlt) && Keyboard.GetState().IsKeyDown(Keys.Q)) { Exit(); } StopMoving(); if (!game_over && !console.Opened && IsActive) { HUDState.HandleControls(); } Simulate(gameTime); // var song = GameContent.Instance.vampireKiller; if (MediaPlayer.State != MediaState.Playing && false) { MediaPlayer.Volume = 0.1f; MediaPlayer.Play(GameContent.Instance.Songs[CurrentSongIndex]); CurrentSongIndex = (CurrentSongIndex + 1) % GameContent.Instance.Songs.Count; } base.Update(gameTime); }
private Boolean SetHUDState(HUDState newState) { if (newState != State) { ArduinoInterface.Clear(); State = newState; switch (State) { case HUDState.Wasted: ArduinoInterface.Print("WASTED"); break; case HUDState.Busted: ArduinoInterface.Print("BUSTED"); break; case HUDState.InfoCycle: GoToCycle(Game.Player.Character.IsInVehicle() ? HUDCycle.VehicleSpeed : HUDCycle.WorldInfo, true); break; } return true; } return false; }
private Boolean SetHUDState(HUDState newState) { if (newState != state) { ArduinoInterface.Clear(); Timer = 0; state = newState; switch (state) { case HUDState.Wasted: ArduinoInterface.Print("WASTED"); break; case HUDState.PlayerHealth: PlayerHealth = -1; PlayerArmor = -1; ArduinoInterface.SetCursor(0, 0); ArduinoInterface.Print("Health: 0%"); ArduinoInterface.SetCursor(0, 1); ArduinoInterface.Print(" Armor: 0%"); break; case HUDState.VehicleHealth: VehicleBodyHealth = -1; VehicleEngineHealth = -1; ArduinoInterface.SetCursor(0, 0); ArduinoInterface.Print(" Body: 0%"); ArduinoInterface.SetCursor(0, 1); ArduinoInterface.Print("Engine: 0%"); break; } return true; } return false; }
// Start is called before the first frame update void Start() { hudState = HUDState.BASE; RefreshHUDSDisplay(); mouse = Camera.main.GetComponent <MouseBehaviour>(); }
public void Default() { _ui = new Default(_game); _state = HUDState.Default; }
public void Pause() { _ui = new PauseMenu(_game); _state = HUDState.Pause; }
void updateHUDFor(Player player, HUDState state, string message = null) { int playerIndex = players.IndexOf (player); SKSpriteNode avatar = hudAvatars [playerIndex]; avatar.RunAction (SKAction.Sequence (new [] { SKAction.FadeAlphaTo (1f, 1), SKAction.FadeAlphaTo (0.2f, 1), SKAction.FadeAlphaTo (1f, 1) })); SKLabelNode label = hudLabels [playerIndex]; float heartAlpha = 1f; switch (state) { case HUDState.Local: label.Text = "ME"; break; case HUDState.Connecting: heartAlpha = 0.25f; label.Text = message ?? "AVAILABLE"; break; case HUDState.Disconnected: avatar.Alpha = 0.5f; heartAlpha = 0.1f; label.Text = "NO PLAYER"; break; case HUDState.Connected: label.Text = message ?? "CONNECTED"; break; default: throw new NotImplementedException (); } for (int i = 0; i < player.LivesLeft; i++) { SKSpriteNode heart = hudLifeHeartArrays [playerIndex] [i]; heart.Alpha = heartAlpha; } }
public void OnClick_ResumeButton() { hudState = HUDState.Active; ToggleMenus(); }
// Start is called before the first frame update void Start() { stateHUD = HUDState.FlightState; }