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; }
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; }
public void DecayCondition() { int curCondition = (int)machineCondition; if (curCondition <= 0) { return; } machineCondition = (MachineCondition)curCondition - 1; }
public void RepairCondition() { // called if mini game was succesful // RETURN if already at MAX condition if ((int)machineCondition >= System.Enum.GetValues(typeof(MachineCondition)).Length) { return; } int curCondition = (int)machineCondition; machineCondition = (MachineCondition)curCondition + 1; }
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(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(); }