internal static void StartGame(string mapUID, WorldType type) { // Dispose of the old world before creating a new one. if (worldRenderer != null) { worldRenderer.Dispose(); } Cursor.SetCursor(null); BeforeGameStart(); Map map; using (new PerfTimer("PrepareMap")) map = ModData.PrepareMap(mapUID); using (new PerfTimer("NewWorld")) OrderManager.World = new World(ModData, map, OrderManager, type); OrderManager.World.GameOver += FinishBenchmark; worldRenderer = new WorldRenderer(ModData, OrderManager.World); GC.Collect(); using (new PerfTimer("LoadComplete")) OrderManager.World.LoadComplete(worldRenderer); // Create a Http server and start listening for incoming connections // Handle requests if (OrderManager.World.LocalPlayer != null && HttpServer.Listener == null) { HttpServer.Listener = new HttpListener(); HttpServer.Listener.Prefixes.Add(HttpServer.Url); HttpServer.Listener.Start(); Console.WriteLine("Listening for connections on {0}", HttpServer.Url); HttpServer.HandleIncomingConnections(); } GC.Collect(); if (OrderManager.GameStarted) { return; } Ui.MouseFocusWidget = null; Ui.KeyboardFocusWidget = null; OrderManager.LocalFrameNumber = 0; OrderManager.LastTickTime = RunTime; OrderManager.StartGame(); worldRenderer.RefreshPalette(); Cursor.SetCursor("default"); GC.Collect(); }
internal static void StartGame(string mapUID, WorldType type) { // Dispose of the old world before creating a new one. worldRenderer?.Dispose(); Cursor.SetCursor(null); BeforeGameStart(); Map map; using (new PerfTimer("PrepareMap")) map = ModData.PrepareMap(mapUID); using (new PerfTimer("NewWorld")) { OrderManager.World = new World(ModData, map, OrderManager, type); OrderManager.FramesAhead = OrderManager.World.OrderLatency; } OrderManager.World.GameOver += FinishBenchmark; worldRenderer = new WorldRenderer(ModData, OrderManager.World); // Proactively collect memory during loading to reduce peak memory. GC.Collect(); using (new PerfTimer("LoadComplete")) OrderManager.World.LoadComplete(worldRenderer); // Proactively collect memory during loading to reduce peak memory. GC.Collect(); if (OrderManager.GameStarted) { return; } Ui.MouseFocusWidget = null; Ui.KeyboardFocusWidget = null; OrderManager.LocalFrameNumber = 0; OrderManager.LastTickTime = RunTime; OrderManager.StartGame(); worldRenderer.RefreshPalette(); Cursor.SetCursor(ChromeMetrics.Get <string>("DefaultCursor")); // Now loading is completed, now is the ideal time to run a GC and compact the LOH. // - All the temporary garbage created during loading can be collected. // - Live objects are likely to live for the length of the game or longer, // thus promoting them into a higher generation is not an issue. // - We can remove any fragmentation in the LOH caused by temporary loading garbage. // - A loading screen is visible, so a delay won't matter to the user. // Much better to clean up now then to drop frames during gameplay for GC pauses. GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; GC.Collect(); }
void Update() { if (Input.GetKeyDown("q")) { Instrument = Instruments.Hand; cursorManager.SetCursor(0); } else if (Input.GetKeyDown("w")) { Instrument = Instruments.TuningFork; cursorManager.SetCursor(1); } else if (Input.GetKeyDown("e")) { Instrument = Instruments.HammerUp; cursorManager.SetCursor(2); } else if (Input.GetKeyDown("r")) { Instrument = Instruments.HammerDown; cursorManager.SetCursor(3); } Vector3 pos = Input.mousePosition; pos.z = transform.position.z - Camera.main.transform.position.z; Vector3 mousePosition = Camera.main.ScreenToWorldPoint(pos); RaycastHit2D hit = Physics2D.Raycast(new Vector2(mousePosition.x, mousePosition.y), new Vector2(), 0f); if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) { if (hit.collider) { TunableIntenstine organ = hit.collider.gameObject.GetComponent <TunableIntenstine>(); if (Instrument == Instruments.HammerUp) { organ.changeCurrentFrequency(tuneValue); } else if (Instrument == Instruments.HammerDown) { organ.changeCurrentFrequency(tuneValue * -1); } else if (Instrument == Instruments.TuningFork) { organ.checkFrequency(damage); } } } }
public void OnCursorEnter() { //Debug.Log (IsOpen); if (IsOpen) { //Debug.Log ("enter"); if (!m_repeat && IsClose) { return; } m_isTrigger = true; CursorManager.SetCursor(m_cursor); #if UNITY_STANDALONE_WIN || UNITY_EDITOR if (!string.IsNullOrEmpty(m_hint)) { m_msgCtr = MessageUI.AutoShowMessage(m_hint, false, () => { if (null != m_msgCtr) { GameObject.Destroy(m_msgCtr.gameObject); m_msgCtr = null; } }, 1); } #endif } }
public void Message(string message, object[] parameters) { if (message.Equals("Up")) { uiCtr.ShowIceboxUp(); } else if (message.Equals("Down")) { uiCtr.ShowIceboxDown(); } else if (message.Equals("Out")) { GameStateManager.Instance().FSM.ChangeState(GameStateKitchen.Instance()); } else if (message.Equals("ShowBrainAniOver")) { Debug.Log("show brain ani over"); GameData.HasBrain = true; CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); GameStateManager.Instance().FSM.GlobalState.Message("GetBrain", null); } else if (message.Equals("ShowBrain")) { if (!GameData.HasBrain) { CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); uiCtr.ShowBrainAnimation(); GameData.HasBrain = true; } } }
public void OnShowStomachOver() { Debug.Log("OnShowStomachOver"); GameStateManager.Instance().FSM.CurrentState.Message("ShowStomachAniOver", null); m_anim.SetBool("play", false); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); }
public virtual void UpdateMenuOptions() { if (this.m_OptionsObjects.Count > 0) { if (GreenHellGame.IsPCControllerActive()) { this.m_ActiveMenuOption = null; foreach (MenuBase.MenuOptionData data in this.m_OptionsObjects.Values) { this.UpdateActiveMenuOption(data); } } foreach (MenuBase.MenuOptionData data2 in this.m_OptionsObjects.Values) { this.UpdateMenuOptionAnimation(data2); } if (!GreenHellGame.IsYesNoDialogActive()) { CursorManager cursorManager = CursorManager.Get(); if (cursorManager == null) { return; } cursorManager.SetCursor((this.m_ActiveMenuOption != null && this.m_ActiveMenuOptionCanInteract && !GreenHellGame.GetFadeSystem().IsFadeVisible()) ? CursorManager.TYPE.MouseOver : CursorManager.TYPE.Normal); } } }
public void OnShadowAniPlayOver() { AudioManager.Instance.StopAudio(m_hitWindowAudio.name); m_shadowAni.SetBool("play", false); NotifyActionOverEvent(); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); }
void Awake() { posExit = transform.localPosition; posEnter = (Vector2)transform.localPosition + hoverBehaviour_Move_Amount; SetHoverBehaviourType(hoverBehaviourType); #if SOUND_MANAGER // Sound Manager internalOnPointerEnterFunc += () => { if (mouseOverSound != Sound_Manager.Sound.None) { Sound_Manager.PlaySound(mouseOverSound); } }; internalOnPointerClickFunc += () => { if (mouseClickSound != Sound_Manager.Sound.None) { Sound_Manager.PlaySound(mouseClickSound); } }; #endif #if CURSOR_MANAGER // Cursor Manager internalOnPointerEnterFunc += () => { if (cursorMouseOver != CursorManager.CursorType.None) { CursorManager.SetCursor(cursorMouseOver); } }; internalOnPointerExitFunc += () => { if (cursorMouseOut != CursorManager.CursorType.None) { CursorManager.SetCursor(cursorMouseOut); } }; #endif }
void Awake() { SetHoverBehaviourType(hoverBehaviourType); #if SOUND_MANAGER // Sound Manager internalOnPointerEnterFunc += () => { if (mouseOverSound != Sound_Manager.Sound.None) { Sound_Manager.PlaySound(mouseOverSound); } }; internalOnPointerClickFunc += () => { if (mouseClickSound != Sound_Manager.Sound.None) { Sound_Manager.PlaySound(mouseClickSound); } }; #endif #if CURSOR_MANAGER // Cursor Manager internalOnPointerEnterFunc += () => { if (cursorMouseOver != CursorManager.CursorType.None) { CursorManager.SetCursor(cursorMouseOver); } }; internalOnPointerExitFunc += () => { if (cursorMouseOut != CursorManager.CursorType.None) { CursorManager.SetCursor(cursorMouseOut); } }; #endif }
private void FixedUpdate() { RaycastHit2D hit = Physics2D.Raycast(mousePos, Vector2.zero, float.MaxValue, objectLayer); if (hit.collider != null && joint.connectedBody == null) { if (Vector2.Distance(hit.point, transform.position) <= maxDistance) { CursorManager.SetCursor(Cursors.Pickup); } else { CursorManager.SetCursor(Cursors.PickupOutOfRange); } } else { CursorManager.SetCursor(Cursors.Pointer); } if (mouseClick) { mouseClick = false; if (joint.connectedBody == null) { if (hit.collider != null) { if (Vector2.Distance(hit.point, transform.position) <= maxDistance) { joint.enabled = true; joint.connectedBody = hit.rigidbody; hit.transform.gameObject.layer = LayerMask.NameToLayer(playerObjectLayerName); //joint.connectedAnchor = hit.point.Sub(transform.position); } } } else { joint.enabled = false; joint.connectedBody.gameObject.layer = LayerMask.NameToLayer(objectLayerName); joint.connectedBody = null; } } Vector2 anchor = mousePos.Sub(transform.position); if (anchor.magnitude > maxDistance) { anchor = anchor.normalized * maxDistance; } if (transform.lossyScale.x < 0) { anchor.x *= -1; } joint.anchor = anchor; }
public void ShowIceboxUp() { m_openUpImage.SetActive(true); m_openDownImage.SetActive(false); m_upHit.SetActive(false); m_downHit.SetActive(true); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); }
public void OnWaterAniPlayOver() { m_waterAni.SetBool("play", false); NotifyActionOverEvent(); m_handHit.SetActive(true); m_water.SetActive(false); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); }
public void OnPointerEnter(PointerEventData eventData) { if (!heroMenu.itemTooltip.gameObject.activeInHierarchy && (_itemStack != null && (_itemStack.item is ItemWeaponBase || _itemStack.item is ItemArmor))) { heroMenu.itemTooltip.gameObject.SetActive(true); heroMenu.itemTooltip.transform.position = transform.position - heroMenu.tooltipOffset; heroMenu.itemTooltip.SetTooltipDescription(_itemStack.item); cursorManager.SetCursor(cursorManager.equipItemCursorTexture); } else if (!heroMenu.itemTooltip.gameObject.activeInHierarchy && (_itemStack != null && (_itemStack.item is Item))) { cursorManager.SetCursor(cursorManager.drinkPotionCursorTexture); } }
public override void Play(int eventID) { AudioManager.Instance.PlayAudio(m_audioClip, false); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); NotifyActionOverEvent(); m_showGO.SetActive(true); m_coinGO.SetActive(true); }
public void HighlightGate() { if (!isGateOpening) { cursorManager.SetCursor(hoverCursorTexture, true); outline.enabled = true; } }
IEnumerator UnlockOver(float second) { yield return(new WaitForSeconds(second)); m_openComputerGO.SetActive(true); m_closeComputerGO.SetActive(false); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); }
public void OnPainterAniPlayOver() { m_isPlaying = false; m_painterAni.SetBool("play", false); NotifyActionOverEvent(); m_lungGO.SetActive(true); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); }
public void Enter(GameStateBase owner) { CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); //GameObject prefab = Resources.Load ("HallScene")as GameObject; ResourcesManager.Instance.Load("HallScene", (Object asset) => { go = GameObject.Instantiate((GameObject)asset); }); }
internal static void StartGame(string mapUID, WorldType type) { // Dispose of the old world before creating a new one. if (worldRenderer != null) { worldRenderer.Dispose(); } Cursor.SetCursor(null); BeforeGameStart(); Map map; using (new PerfTimer("PrepareMap")) map = ModData.PrepareMap(mapUID); using (new PerfTimer("NewWorld")) OrderManager.World = new World(ModData, map, OrderManager, type); OrderManager.World.GameOver += FinishBenchmark; worldRenderer = new WorldRenderer(ModData, OrderManager.World); GC.Collect(); using (new PerfTimer("LoadComplete")) OrderManager.World.LoadComplete(worldRenderer); GC.Collect(); if (OrderManager.GameStarted) { return; } Ui.MouseFocusWidget = null; Ui.KeyboardFocusWidget = null; OrderManager.LocalFrameNumber = 0; OrderManager.LastTickTime = RunTime; OrderManager.StartGame(); worldRenderer.RefreshPalette(); Cursor.SetCursor("default"); GC.Collect(); }
IEnumerator OnBrokenAudioPlayOver(float second) { yield return(new WaitForSeconds(second)); //BrokenMirror.SetActive(false); Mirror.SetActive(false); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); NotifyActionOverEvent(); }
public void OnBookAniPlayOver() { m_bookOpenGO.SetActive(true); m_bookNextHit.SetActive(true); m_isPlaying = false; m_bookAni.SetBool("play", false); NotifyActionOverEvent(); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); }
public void OnPlayFingerAniOver() { m_fingerAni.SetBool("play", false); m_handGO.SetActive(false); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); NotifyActionOverEvent(); GameStateManager.Instance().FSM.GlobalState.Message("GetFinger", null); GameData.HasFinger = true; }
public void OnLungAniPlayOver() { m_isPlaying = false; m_lungAni.SetBool("play", false); NotifyActionOverEvent(); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); GameData.HasLung = true; GameStateManager.Instance().FSM.GlobalState.Message("GetLung", null); }
// Use this for initialization void Start() { FSM = new StateMachine(this); GameStateManager.Instance().FSM = FSM; FSM.ChangeState(GameStateMenu.Instance()); // FSM.GlobalState = GameGlobalState.Instance (); // FSM.GlobalState.Enter (FSM.Owner); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); }
IEnumerator OnGhostAniPlayOver(float second) { yield return(new WaitForSeconds(second)); m_computerHit.SetActive(true); m_ghostGO.SetActive(false); m_isPlaying = false; NotifyActionOverEvent(); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); }
public void OnCoinAniOver() { // m_isPlaying = false; m_coinAni.SetBool("play", false); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); NotifyActionOverEvent(); GameData.HasCoin = true; GameStateManager.Instance().FSM.GlobalState.Message("GetCoin", null); }
public void Enter(GameStateBase owner) { m_owner = (GameMenu)owner; CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); // GameObject prefab = Resources.Load ("MenuCanvas")as GameObject; // go = GameObject.Instantiate (prefab); ResourcesManager.Instance.Load("MenuCanvas", (Object asset) => { go = GameObject.Instantiate((GameObject)asset); }); }
public void ShowIceboxDown() { m_openUpImage.SetActive(false); m_openDownImage.SetActive(true); m_downHit.SetActive(false); m_upHit.SetActive(true); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); AudioManager.Instance.PlayAudio(m_ghostAudio, false); StartCoroutine(ShowIceboxDownOver(1)); }
public void OnDropLightUpAniOver() { m_isPlaying = false; m_droplightAni.SetBool("up", false); CursorManager.SetCursor(CursorManager.CursorState.DEFAULT); NotifyActionOverEvent(); m_droplightUpHit.GetComponent <Image>().raycastTarget = false; m_droplightDownHit.GetComponent <Image>().raycastTarget = true; m_mask.SetActive(false); }