Ejemplo n.º 1
0
    /// <summary>
    /// Creates a duplicate of this status.
    /// </summary>
    public virtual PawnStatus Duplicate()
    {
        PawnStatus duplicate = (PawnStatus)Activator.CreateInstance(GetType());

        duplicate.Duration = Duration;
        return(duplicate);
    }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 5
0
    public void HandleOnStatusExpired(PawnStatus status)
    {
        StatusFrame existingFrame = statusFrames.FirstOrDefault(s => s.StatusName == status.Name);

        if (existingFrame != null)
        {
            existingFrame.DecrementStatusCount();
        }
    }
Ejemplo n.º 6
0
    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);
    }
Ejemplo n.º 7
0
    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);
    }
Ejemplo n.º 8
0
    public override bool Collate(PawnStatus other)
    {
        // Can't stack weakness - just extend duration.
        if (other is WeakenedStatus)
        {
            Duration += other.Duration;
            return(false);
        }

        return(true);
    }
Ejemplo n.º 9
0
    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);
    }
Ejemplo n.º 10
0
 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;
     }
 }
Ejemplo n.º 11
0
    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();
    }
Ejemplo n.º 12
0
    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);
    }
Ejemplo n.º 13
0
    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);
    }
Ejemplo n.º 14
0
    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);
    }
Ejemplo n.º 15
0
    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);
    }
Ejemplo n.º 16
0
    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);
    }
Ejemplo n.º 18
0
    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);
            }
        }
    }
Ejemplo n.º 19
0
    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);
    }
Ejemplo n.º 20
0
    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();
    }
Ejemplo n.º 21
0
 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);
 }
Ejemplo n.º 22
0
        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,
                    };
                }
            }
        }
Ejemplo n.º 23
0
 public override bool Collate(PawnStatus other)
 {
     // Block agility and evasive statuses
     return(other is AgilityStatus ||
            other is EvasiveStatus);
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Checks for and handle interactions between statuses.
 /// </summary>
 public virtual bool Collate(PawnStatus other)
 {
     return(false);
 }
Ejemplo n.º 25
0
 private void Start()
 {
     pawnStatus = PawnManager.ReadPawnStatus();
 }
Ejemplo n.º 26
0
 void Start()
 {
     MB      = gameObject.GetComponent <Mapbehavior>();
     PS      = gameObject.GetComponent <PawnStatus>();
     outline = gameObject.GetComponent <Outline>();
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Convenience method for adding statuses that are linked.
 /// </summary>
 public LinkedStatuses Add(PawnStatus status)
 {
     linkedStatuses.Add(status);
     return(this);
 }