public void Initialize(MiniGameDifficulty difficulty) { // The starting difficulty based on machine's efficiency difficultyOffset = 0; if ((int)difficulty > 0) { difficultyOffset = (int)difficulty; } // Set speed of moving obj according to difficulty speed = (int)difficulty > 0 ? (int)difficulty * 100 : 100; // Start goal in center float goalPosition = 0; if (isHorizontal) { float lineWidth = lineTransform.sizeDelta.x * 0.5f; left = -lineWidth + 2; right = lineWidth - 2; goal_obj.transform.localPosition = new Vector2(goalPosition, goal_obj.transform.localPosition.y); } else { goal_obj.transform.localPosition = new Vector2(goal_obj.transform.localPosition.y, goalPosition); } StartMiniGame(); }
protected Machine(MachinePrototype b) : base(b.name, b.sprite, b.animatorController, BuildableType.Machine, b.stats) { this.systemControlled = b.systemControlled; this.repairDifficulty = b.repairDifficulty; this.tileWidth = b.tileWidth; this.tileHeight = b.tileHeight; this.machineCondition = b.machineCondition; }
protected Machine(ProducerPrototype prodProto) : base(prodProto.name, prodProto.sprite, prodProto.animatorController, BuildableType.Producer, prodProto.stats) { this.systemControlled = ShipSystemType.None; this.repairDifficulty = prodProto.repairDifficulty; this.tileHeight = prodProto.tileHeight; this.tileWidth = prodProto.tileWidth; this.machineCondition = prodProto.machineCondition; }
public void SetDifficulty(MiniGameDifficulty difficulty) { this.difficulty = difficulty; if (difficulty != MiniGameDifficulty.Easy) { processScreens[indexOfPriceScreen] = pinScreen; } }
public void Initialize(MiniGameDifficulty difficulty) { movementDuration = 1; if ((int)difficulty > 0) { float diff = (int)difficulty; diff = diff / 10; movementDuration -= diff; } Initialize(); }
public bool HasCompletedDifficulty(MiniGameDifficulty difficulty) { for (int i = 0; i < DifficultySettings.Length; i++) { if (DifficultySettings[i].Type == difficulty) { return(DifficultySettings[i].Completed); } } return(false); }
public void SetSetting(MiniGameSetting setting) { MiniGameDifficulty difficulty = minigameButton.Difficulty; if (difficulty != MiniGameDifficulty.Easy) { bool hasCompletedDifficulty = setting.HasCompletedDifficulty(difficulty - 1); button.interactable = hasCompletedDifficulty; icon.color = hasCompletedDifficulty ? Color.white : uninteractableColor; } }
public void StartSlipItemGame(Vector2 position, MiniGameDifficulty difficulty, Action onSuccess, Action onFail) { if (miniGame_Slip.gameObject.activeSelf == true) { return; } miniGame_Slip.gameObject.SetActive(true); miniGame_Slip.transform.position = position + new Vector2(0, 2); miniGame_Slip.Initialize(difficulty); onDropGameSuccessCB += onSuccess; onDropGameFailCB += onFail; miniGame_Slip.onGameSuccess += OnSlipItemSuccess; miniGame_Slip.onGameFail += OnSlipItemFail; }
//method used for adding rewards to the rewardCollection list by the difficulty set for a minigame, converted to the enum RewardType before adding to the list //easy = bronze //medium = silver //hard = gold public void AddRewardThroughDifficulty(string name, MiniGameDifficulty difficulty) { switch (difficulty) { case MiniGameDifficulty.Easy: rewardCollection.Add(new Tuple <string, RewardType>(name, RewardType.Bronze)); break; case MiniGameDifficulty.Medium: rewardCollection.Add(new Tuple <string, RewardType>(name, RewardType.Silver)); break; case MiniGameDifficulty.Hard: rewardCollection.Add(new Tuple <string, RewardType>(name, RewardType.Gold)); break; } SaveToFile(); }
public bool SetDifficultyCompleted(MiniGameDifficulty difficulty) { for (int i = 0; i < DifficultySettings.Length; i++) { if (DifficultySettings[i].Type == difficulty) { if (!DifficultySettings[i].Completed) { DifficultySettings[i].Completed = true; return(true); } else { return(false); } } } return(false); }
public void Initialize(MachineCondition curMachineCondition, MiniGameDifficulty difficulty) { // The starting difficulty based on machine's efficiency difficultyOffset = 0; if ((int)difficulty > 0) { difficultyOffset = (int)difficulty; } // The difficulty offset based on current condition of machine int minusCondition = 2 - (int)curMachineCondition; if (minusCondition > 0) { for (int i = 0; i < minusCondition; i++) { IncreaseDifficulty(); } } // Set speed of moving obj according to difficulty speed = (int)difficulty > 0 ? (int)difficulty * 100 : 100; float goalPosition = 0; if (isHorizontal) { float lineWidth = lineTransform.sizeDelta.x * 0.5f; left = -lineWidth + 2; right = lineWidth - 2; Debug.Log("MINIGAME: left = " + left + " right = " + right); goalPosition = Random.Range(left, right); goal_obj.transform.localPosition = new Vector2(goalPosition, goal_obj.transform.localPosition.y); } else { float lineHeight = lineTransform.sizeDelta.y * 0.5f; goalPosition = Random.Range(-lineHeight + 2, lineHeight - 2); goal_obj.transform.localPosition = new Vector2(goal_obj.transform.localPosition.y, goalPosition); } StartMiniGame(); }
public void Initialize(MiniGameDifficulty difficulty) { if (pool == null) { pool = ObjectPool.instance; } ballsCaught = 0; isSuccess = false; pStartDelay = startDelay; ballsReq = 1; fallDuration = pFallDuration; duration = pDuration; if (difficulty > 0) { float offset = (int)difficulty; offset = offset / 10; fallDuration -= offset; fallDuration = Mathf.Clamp(fallDuration, 0.1f, 1); duration += (int)difficulty / 10; ballsReq += (int)difficulty; Debug.Log("Slip game Fall duration set to: " + fallDuration + " offset was " + offset); } ballReqPanel.transform.position = Camera.main.WorldToScreenPoint(new Vector3(gamePanel.transform.position.x, gamePanel.transform.position.y - 1)); ballReqPanel.SetActive(true); ballReqText.text = ballsReq.ToString(); ballCaughtText.text = "0"; //durationCountdown = new CountdownHelper(duration); gamePanel.transform.DOScale(1.5f, 0.25f).SetLoops(2, LoopType.Yoyo); sequence = DOTween.Sequence(); minX = -1.5f; maxX = 1.5f; destX = 0; net.transform.localPosition = Vector2.zero; SpawnBall(); }
public void Initialize(MachineCondition curMachineCondition, MiniGameDifficulty difficulty) { movementDuration = 1; if ((int)difficulty > 0) { float diff = (int)difficulty; diff = diff / 10; movementDuration -= diff; } // The difficulty offset based on current condition of machine // if it's condition is less than OK (3) if ((int)curMachineCondition <= 2) { float diff = (int)curMachineCondition; diff = diff / 10; if (diff > 0) { movementDuration -= diff; } } Initialize(); }
public bool HasCompletedDifficulty(MiniGameDifficulty difficulty) { return(progression.HasCompletedDifficulty(difficulty)); }
public void SetDifficulty(MiniGameDifficulty newDifficulty) { difficulty = newDifficulty; }