public void Save() { PlayerData.scenename = SceneManager.GetActiveScene().name; PlayerData.position = detective.position; CMDebug.TextPopupMouse("Saved!"); data.Save(); }
// Start is called before the first frame update void Start() { Debug.Log("console: GameHandler.Start"); int i = 0; FunctionPeriodic.Create(() => { CMDebug.TextPopupMouse("Ding " + i + "!"); i++; }, .5f); }
private void Update() { if (Input.GetMouseButtonDown(0)) { // Spawn a pistol and queue the task to take it to a slot when possible GameObject pistolGameObject = SpawnPistolSprite(UtilsClass.GetMouseWorldPosition()); taskSystem.EnqueueTask(() => { foreach (WeaponSlot weaponSlot in weaponSlotList) { if (weaponSlot.IsEmpty()) { // If the weapon slot is empty lets create the task to take it there weaponSlot.SetHasWeaponIncoming(true); Task task = new Task.TakeWeaponToWeaponSlot { weaponPosition = pistolGameObject.transform.position, weaponSlotPosition = weaponSlot.GetPosition(), grabWeapon = (CM_WorkerTaskAI weaponWorkerTaskAI) => { // Grab weapon, parent the weapon to the worker pistolGameObject.transform.SetParent(weaponWorkerTaskAI.transform); }, dropWeapon = () => { // Drop weapon, set parent back to null pistolGameObject.transform.SetParent(null); // Notify the weapon slot that the weapon has arrived weaponSlot.SetWeaponTransform(pistolGameObject.transform); }, }; return(task); } // Weapon slot not empty, keep looking } // No weapon slot is empty, try again later return(null); }); //CMDebug.TextPopupMouse("Add Task: ShellFloorCleanUp, 5s delay"); //SpawnFloorShellsWithTask(UtilsClass.GetMouseWorldPosition()); } if (Input.GetMouseButtonDown(1)) { CMDebug.TextPopupMouse("Add Task: MoveToPosition"); //CM_TaskSystem.Task task = new CM_TaskSystem.Task.Victory { }; //taskSystem.AddTask(task); Task task = new Task.MoveToPosition { targetPosition = UtilsClass.GetMouseWorldPosition() }; taskSystem.AddTask(task); } if (Input.GetKeyDown(KeyCode.Alpha1)) { CMDebug.TextPopupMouse("Add Task: Victory"); Task task = new Task.Victory { }; taskSystem.AddTask(task); } }
// Update is called once per frame void Update() { if (Input.GetKeyUp(KeyCode.Space)) { //LowSpeedEffect(); timeManager.DoSlowMotion(); } if (Input.GetMouseButtonUp(1)) { CMDebug.TextPopupMouse("Disparando"); //Shoot(); } }
public void DequeueTask() { for (int i = 0; i < queuedTaskList.Count; i++) { QueuedTask <T> queuedTask = queuedTaskList[i]; T task = queuedTask.DequeueTask(); if (task != null) { AddTask(task); queuedTaskList.RemoveAt(i); i--; CMDebug.TextPopupMouse("Task Dequeue"); } } }
private void Start() { Debug.Log("GameHandler.Start"); int number = 0; FunctionPeriodic.Create(() => { CMDebug.TextPopupMouse("Don't work with this lady! She a ssssnake"); number++; }, .5f); levelGrid = new LevelGrid(20, 20); snake.SetUp(levelGrid); levelGrid.SetUp(snake); }
// Update is called once per frame void Update() { if (GameData.gameState == GUIManager.States.InGame || GameData.gameState == GUIManager.States.Pause) { //实现点击移动 if (Input.GetMouseButtonDown(0)) { //CMDebug.TextPopupMouse(GameData.save.Progress.ToString()+","+level); } if (Input.GetKeyUp(KeyCode.Escape)) { if (Time.timeScale > 0.0f) { moveObject.PauseGame(); } else { moveObject.m.ResumeGame(); } } GameData.UpdateShipStatus(); FlushGameLists(shells); } if (GameData.gameState == GUIManager.States.Outfit) { if (GUIManager.outfitTurrets != null) { GUIManager.outfitTurrets = GUIManager.FlushNullInArray(GUIManager.outfitTurrets); } //有泄漏就明显报错 foreach (GameObject i in GUIManager.outfitTurrets) { if (i == null) { CMDebug.TextPopupMouse("!!"); } } if (Input.GetKeyUp(KeyCode.Escape)) { GameObject.Find("EventSystem").GetComponent <GUIManager>().CleanOutfitScreen(); GUIManager.ShowGUI(GUIManager.States.SelectLevels); } } //if (Input.GetMouseButtonDown(0)) //{ // CMDebug.TextPopupMouse(GameData.gameState.ToString()); //} }
public static bool TrySpendResourcesCost() { if (GameResources.GetResourceAmount(GameResources.ResourceType.Wood) >= 10 && GameResources.GetResourceAmount(GameResources.ResourceType.Gold) >= 5) { // We do have resources GameResources.RemoveResourceAmount(GameResources.ResourceType.Wood, 10); GameResources.RemoveResourceAmount(GameResources.ResourceType.Gold, 5); // Spawn Tower return(true); } else { // Not enough resources CMDebug.TextPopupMouse("Not enough resources!\nWood: 10; Gold: 5"); return(false); } }
private void Awake() { guestSpritesheetData = GuestSpritesheetData.GenerateRandom(); SetGuestSpritesheetData(guestSpritesheetData); CMDebug.ButtonUI(new Vector2(100, -170), "Randomize", () => { guestSpritesheetData = GuestSpritesheetData.GenerateRandom(); SetGuestSpritesheetData(guestSpritesheetData); }); CMDebug.ButtonUI(new Vector2(250, -170), "Save", () => { guestSpritesheetData.Save(); CMDebug.TextPopupMouse("Saved!"); }); CMDebug.ButtonUI(new Vector2(400, -170), "Load", () => { guestSpritesheetData = GuestSpritesheetData.Load_Static(); SetGuestSpritesheetData(guestSpritesheetData); CMDebug.TextPopupMouse("Loaded!"); }); }
private void Start() { _highscoretable = GameObject.Find("HighscoreTable").GetComponent <highscoretable>(); inputWindow.Show("Enter name", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 3, () => { CMDebug.TextPopupMouse("Cancel!"); }, (inputText) => { CMDebug.TextPopupMouse("Ok: " + inputText); if (GameObject.Find("scoreman") == null) { } else { _highscoretable.AddHighscore(m_score, inputText); } }); }
private void DequeueTasks() { for (int i = 0; i < queuedTaskList.Count; i++) { QueuedTask <TTask> queuedTask = queuedTaskList[i]; TTask task = queuedTask.TryDequeueTask(); if (task != null) { // Task dequeued! Add to normal list AddTask(task); queuedTaskList.RemoveAt(i); i--; CMDebug.TextPopupMouse("Task Dequeued"); } else { // Returned task is null, keep it queued } } }
private void Update() { if (Input.GetMouseButton(0)) { Vector3 mouseWorldPosition = UtilsClass.GetMouseWorldPosition(); tilemap.SetTilemapSprite(mouseWorldPosition, tilemapSprite); } if (Input.GetKeyDown(KeyCode.T)) { tilemapSprite = Tilemap.TilemapObject.TilemapSprite.None; CMDebug.TextPopupMouse(tilemapSprite.ToString()); } if (Input.GetKeyDown(KeyCode.Y)) { tilemapSprite = Tilemap.TilemapObject.TilemapSprite.Ground; CMDebug.TextPopupMouse(tilemapSprite.ToString()); } if (Input.GetKeyDown(KeyCode.U)) { tilemapSprite = Tilemap.TilemapObject.TilemapSprite.Path; CMDebug.TextPopupMouse(tilemapSprite.ToString()); } if (Input.GetKeyDown(KeyCode.I)) { tilemapSprite = Tilemap.TilemapObject.TilemapSprite.Dirt; CMDebug.TextPopupMouse(tilemapSprite.ToString()); } if (Input.GetKeyDown(KeyCode.P)) { tilemap.Save(); CMDebug.TextPopupMouse("Saved!"); } if (Input.GetKeyDown(KeyCode.L)) { tilemap.Load(); CMDebug.TextPopupMouse("Loaded!"); } }
// Start is called before the first frame update void Start() { //llama al text box textBox.Show((string inputText) => { CMDebug.TextPopupMouse(inputText); nombreArchivo = inputText; //prueba para comprobar que se obtiene el dato correctamente Debug.Log(nombreArchivo + ".txt"); leertxt(nombreArchivo + ".txt"); matriz = new int[Filas.Count, Columnas.Count]; Grupos = new int[Filas.Count]; for (int i = 0; i < Filas.Count; i++) { Grupos[i] = Filas[i].Length; Debug.Log("GRUPO " + i + ": " + Grupos[i]); } DateTime inicio = DateTime.Now; rellenarMatriz(); nonogram miNonogram = new nonogram(matriz, X, Y, nonogramContainer, cVaciaSprite, cRellenaSprite); DateTime final = DateTime.Now; TimeSpan duracion = final - inicio; Debug.Log(duracion.ToString("hh\\:mm\\:ss")); }); }
private void HandleTouchInput() { if (Input.touchCount > 0) { touch = Input.GetTouch(0); if (touch.phase == TouchPhase.Began) { touchStartPosition = touch.position; } else if (touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Ended) { touchEndPosition = touch.position; // Calculate Vector of movement float x = touchEndPosition.x - touchStartPosition.x; float y = touchEndPosition.y - touchStartPosition.y; // Round Movement float absX = Mathf.Abs(x); float absY = Mathf.Abs(y); if (absX <= 2 && absY <= 2) { CMDebug.TextPopupMouse("Swipe to Move!"); } else if (absX > absY) { if (x >= touchSensitivity) { if (gridMoveDirection != Direction.Left) { gridMoveDirection = Direction.Right; } } else if (x <= -touchSensitivity) { if (gridMoveDirection != Direction.Right) { gridMoveDirection = Direction.Left; } } } else { if (y >= touchSensitivity) { if (gridMoveDirection != Direction.Down) { gridMoveDirection = Direction.Up; } } else if (y <= -touchSensitivity) { if (gridMoveDirection != Direction.Up) { gridMoveDirection = Direction.Down; } } } } } }
private void HealthPostureSystem_OnPostureBroken(object sender, System.EventArgs e) { CMDebug.TextPopupMouse("Posture Broken!"); //postureBarHighlightGameObject.SetActive(true); }
private void HeartsHealthSystem_OnDead(object sender, System.EventArgs e) { CMDebug.TextPopupMouse(""); }
private void HealthPostureSystem_OnDead(object sender, System.EventArgs e) { CMDebug.TextPopupMouse("Dead!"); }
private void Bird_OnDied(object sender, System.EventArgs e) { CMDebug.TextPopupMouse("DEAD!"); state = State.BirdDead; }