/// <summary> /// Creates a duplicate of this status. /// </summary> public virtual PawnStatus Duplicate() { PawnStatus duplicate = (PawnStatus)Activator.CreateInstance(GetType()); duplicate.Duration = Duration; return(duplicate); }
private void HandleOnStatusExpired(PawnStatus status) { if (linkedStatuses.Contains(status)) { Expire(); } }
public void Activate() { pawnStatus = PawnManager.ReadPawnStatus(); arcadeStatus = ArcadeManager.ReadArcadeStatus(); printers = new List <TicketPrinter>(); for (int i = 0; i < pawnStatus.Printers.Count; i++) { if (pawnStatus.Printers[i].IsActive) { printers.Add(pawnStatus.Printers[i]); ValidatePrinter(pawnStatus.Printers[i]); } } walletText.text = GameOperations.BigIntToString(pawnStatus.Money); UpdateFromReturn(); // Temp until Scroll for (int i = 0; i < ticketPrinterUIs.Count; i++) { ticketPrinterUIs[i].ActivePrinter = pawnStatus.Printers[i]; ticketPrinterUIs[i].Populate(); } gameObject.SetActive(true); buyPopUp.SetActive(false); upgradePopUp.SetActive(false); GetComponent <PrinterTrader>().CloseTradeInPopUp(); }
public void Activate() { gameObject.SetActive(true); closePopUp(); pawnStatus = PawnManager.ReadPawnStatus(); arcadeStatus = ArcadeManager.ReadArcadeStatus(); moneyText.text = GameOperations.BigIntToString(pawnStatus.Money); }
public void HandleOnStatusExpired(PawnStatus status) { StatusFrame existingFrame = statusFrames.FirstOrDefault(s => s.StatusName == status.Name); if (existingFrame != null) { existingFrame.DecrementStatusCount(); } }
public override bool Collate(PawnStatus other) { // Can't stack death timers, just use the lowest duration. if (other is DeathTimerStatus) { Duration = Mathf.Min(other.Duration, Duration); return(true); } return(false); }
public override bool Collate(PawnStatus other) { // Can't stack poison damage - just extends the duration. if (other is PoisonStatus) { Duration += other.Duration; return(true); } return(false); }
public override bool Collate(PawnStatus other) { // Can't stack weakness - just extend duration. if (other is WeakenedStatus) { Duration += other.Duration; return(false); } return(true); }
public static void WritePawnStatus() { if (pawnStatus == null) { pawnStatus = new PawnStatus(); } System.IO.Directory.CreateDirectory(Application.dataPath + "/SaveData"); string unencrypted = "PawnStatus.json\n" + JsonUtility.ToJson(pawnStatus, true); string encrypted = GameOperations.EncryptDecrypt(unencrypted); System.IO.File.WriteAllText(pawnStatusPath, unencrypted); System.IO.File.WriteAllText(encryptedPawnStatusPath, encrypted); }
private void InstantiatePawns() { for (int i = 0; i < 8; i++) { var pawn = Instantiate(Pawn, new Vector3(0 + i, 0.5f, 1), Quaternion.Euler(-90, 0, 0)); var outline = pawn.AddComponent <Outline>(); PS = pawn.GetComponent <PawnStatus>(); PS.SetXPos(i); PS.SetYPos(1); outline.OutlineMode = Outline.Mode.OutlineAll; outline.OutlineColor = Color.yellow; outline.OutlineWidth = 5f; outline.enabled = false; } }
public void InitializePopUp(TicketPrinter printer) { pawnStatus = PawnManager.ReadPawnStatus(); this.printer = printer; popUp.SetActive(true); InitializeUpgradeBars(); printerImage.sprite = printer.GetPrinterSprite(); popUpProgressBar.maxValue = printer.BatchTime; // set up upgrade buttons UpdateUpgradeButtons(); InitializeTicketDropDown(); }
public override bool Collate(PawnStatus other) { // Get outta town! if (other is DrowsyStatus) { return(true); } // Sleep overrides drowsy - remove this status else if (other is SleepStatus) { Expire(); } return(false); }
public override bool Collate(PawnStatus other) { // Get outta town! if (other is HobbleStatus) { return(true); } // Immobilized override hobbled - remove this status else if (other is ImmobilizedStatus) { Expire(); } return(false); }
public override bool Collate(PawnStatus other) { // Can't stack sleep - just pick the longest duration. if (other is SleepStatus) { Duration = Mathf.Max(other.Duration, Duration); return(true); } // Can't get drowsy while sleeping else if (other is DrowsyStatus) { return(true); } return(false); }
public override bool Collate(PawnStatus other) { // Extend duration and combined the number of attacks to evade if (other is EvasiveStatus) { Duration = Mathf.Max(Duration, other.Duration); AttacksToEvade += ((EvasiveStatus)other).AttacksToEvade; return(true); } // Immobilized removes evasive else if (other is ImmobilizedStatus) { Expire(); } return(false); }
public override bool Collate(PawnStatus other) { // Can stack stuns - just pick the longest duration if (other is StunnedStatus) { Duration = Mathf.Max(Duration, other.Duration); return(true); } // Can't be put to sleep or made drowsy while stunned. else if (other is SleepStatus || other is DrowsyStatus) { return(true); } return(false); }
public void InitializeCurrencyView() { arcadeStatus = ArcadeManager.ReadArcadeStatus(); pawnStatus = PawnManager.ReadPawnStatus(); // Set the static currencies moneyText.text = GameOperations.BigIntToString(pawnStatus.Money); prizeTicketText.text = GameOperations.BigIntToString(arcadeStatus.ArcadePrizeStatus.Tickets); // Get the list of statuses to complete dynamic currencies int xPos = 0; int yPos = -10; int yOffset = -70; List <LayerZeroStatus> statuses = arcadeStatus.Statuses; lineItems = new List <GameObject>(); for (int i = 1; i < statuses.Count; i++) { CabinetStatus status = (CabinetStatus)statuses[i]; if (status.IsActive) { // Add prefab // Make the item GameObject lineItem = Instantiate(ticketLinePrefab); lineItem.transform.SetParent(scrollViewTransform, false); lineItems.Add(lineItem); // Set position RectTransform rt = lineItem.GetComponent <RectTransform>(); rt.anchorMin = new UnityEngine.Vector2(0, 0); rt.anchorMax = new UnityEngine.Vector2(1, 1); rt.sizeDelta = new Vector2(200, 50); rt.anchoredPosition = new UnityEngine.Vector3(xPos, yPos, 0); yPos += yOffset; //Populate the prefab with the proper data. lineItem.GetComponent <CurrencyViewUI>().Populate(status); } } int newHeight = Mathf.Max(-yPos, 720); scrollViewTransform.sizeDelta = new Vector2(225, newHeight); }
public void HandleOnStatusApplied(PawnStatus status) { StatusFrame existingFrame = statusFrames.FirstOrDefault(s => s.StatusName == status.Name); if (existingFrame != null) { existingFrame.IncrementStatusCount(); } else { // Get first inactive frame (if there's still some) StatusFrame firstEmptyFrame = statusFrames.FirstOrDefault(s => !s.gameObject.activeSelf); if (firstEmptyFrame != null) { firstEmptyFrame.SetStatus(status.GetType().Name); } } }
public override bool Do(Blackboard state) { // Get relevant data from state. Pawn actor = state.Get <Pawn>("Actor"); Pawn targetPawn = state.Get <Cell>("Cell") ?.GetContent <Pawn>(); // Make a duplicate of the status and apply that instead so // that the above status is not passed to ALL the things // that it is applied to. PawnStatus duplicate = Status.Duplicate(); // Apply status duplicate.Applicator = actor; targetPawn?.Statuses.Add(duplicate); // Update state with the status that was applied state.Add(duplicate.Name, duplicate); // Counts as success if a status was applied. return(targetPawn != null); }
public void InitializePopUp(TicketPrinter printer) { pawnStatus = PawnManager.ReadPawnStatus(); this.printer = printer; nextPrinter = printer.GetNextPrinter(); nextPrinter.PrinterIndex = this.printer.PrinterIndex; popUp.SetActive(true); printerImage.sprite = nextPrinter.GetPrinterSprite(); priceText.text = "This Will Cost:\n$" + GameOperations.BigIntToString(nextPrinter.PurchasePrice); if (pawnStatus.Money < nextPrinter.PurchasePrice) { yesButton.interactable = false; } else { yesButton.interactable = true; } InitializeUpgradeBars(); }
public static PawnStatus ReadPawnStatus() { if (pawnStatus == null) { if (!ValidFile()) { WritePawnStatus(); } else { /* * string readIn = System.IO.File.ReadAllText(encryptedPawnStatusPath); * readIn = GameOperations.EncryptDecrypt(readIn); * readIn = readIn.Substring(readIn.IndexOf("\n") + 1); * pawnStatus = JsonUtility.FromJson<PawnStatus>(readIn); */ string readIn = System.IO.File.ReadAllText(pawnStatusPath); readIn = readIn.Substring(readIn.IndexOf("\n") + 1); pawnStatus = JsonUtility.FromJson <PawnStatus>(readIn); } } return(pawnStatus); }
public GameStatus(GameStatus game) { PlayerBeatings = 0; OpponentBeatings = 0; Value = 0; for (int x = 0; x < 5; x++) { for (int y = 0; y < 5; y++) { var p = game.Pawns[x, y]; if (p == null) { continue; } Pawns[x, y] = new PawnStatus { Number = p.Number, Player = p.Player, }; } } }
public override bool Collate(PawnStatus other) { // Block agility and evasive statuses return(other is AgilityStatus || other is EvasiveStatus); }
/// <summary> /// Checks for and handle interactions between statuses. /// </summary> public virtual bool Collate(PawnStatus other) { return(false); }
private void Start() { pawnStatus = PawnManager.ReadPawnStatus(); }
void Start() { MB = gameObject.GetComponent <Mapbehavior>(); PS = gameObject.GetComponent <PawnStatus>(); outline = gameObject.GetComponent <Outline>(); }
/// <summary> /// Convenience method for adding statuses that are linked. /// </summary> public LinkedStatuses Add(PawnStatus status) { linkedStatuses.Add(status); return(this); }