예제 #1
0
    public void newLoop()
    {
        //loop++;
        for (int i = 0; i < 35; ++i)
        {
            pawns[i].GetComponent <PlaceType>().invasionStatus = false;
        }

        for (int i = 0; i < GameObject.FindGameObjectsWithTag("MapFlag").Length; ++i)
        {
            Destroy(GameObject.FindGameObjectsWithTag("MapFlag")[i]);
        }

        turn = -1;

        PawnManager.Instance().RegenerateMap();

        pawns = GameObject.FindGameObjectsWithTag("MapNode");

        //Sort this array based on id.
        for (int i = 0; i < pawns.Length; ++i)
        {
            GameObject temp;
            temp = pawns[pawns[i].GetComponent <Id>().id];
            pawns[pawns[i].GetComponent <Id>().id] = pawns[i];
            pawns[i] = temp;
        }
        newTurn();
    }
    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();
    }
예제 #3
0
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
예제 #4
0
 private void OnClickOnce(int button, Tile clickedTile)
 {
     if (button == 0)
     {
         var currentTilePawn = pawns.FirstOrDefault(x => x.CurrentTile == clickedTile);
         if (currentTilePawn && !PawnCreater.isCreateMode)
         {
             selectedPawn = currentTilePawn;
         }
         else if (!currentTilePawn && PawnCreater.isCreateMode)
         {
             var pawnInstance = Instantiate(pawnPrefab);
             pawnInstance.name        = $"pawn{pawns.Count}";
             pawnInstance.CurrentTile = clickedTile;
             pawns.Add(pawnInstance);
             PawnManager.GetInstance().AddPawn(pawnInstance, 0);
         }
     }
     else if (button == 1)
     {
         if (selectedPawn && !PawnCreater.isCreateMode)
         {
             selectedPawn.DestinationTile = clickedTile;
         }
     }
 }
 public void Activate()
 {
     gameObject.SetActive(true);
     closePopUp();
     pawnStatus     = PawnManager.ReadPawnStatus();
     arcadeStatus   = ArcadeManager.ReadArcadeStatus();
     moneyText.text = GameOperations.BigIntToString(pawnStatus.Money);
 }
예제 #6
0
 public int PickUpPawn(PawnManager pawn)
 {
     if (pawnsInHand < 5)
     {
         pawnsInHand++;
         pawn.onBoard = false;
     }
     return(pawnsInHand);
 }
예제 #7
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
예제 #8
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();
    }
예제 #9
0
 public void MovePawnsByOneFieldToTheFrontOfTheQueue()
 {
     if (!IsEmpty())
     {
         if (isFull)
         {
             isFull = false;
         }
         // usun pierwszy pionek z kolejki
         FieldManager[] children = gameObject.GetComponentsInChildren <FieldManager>();
         PawnManager    pawn     = children[0].GetComponentInChildren <PawnManager>();
         if (pawn != null)
         {
             pawn.gameObject.transform.SetPositionAndRotation(pawn.startingLocationPosition, pawn.startingLocationRotation);
             pawn.gameObject.transform.parent = null;
             if (pawn.player != null)
             {
                 pawn.player.AddItemToMyProductsEquipment(shop);
                 gameManager.scoreTab.UpdateScoreTab();
                 pawn.player.PickUpPawn(pawn);
             }
         }
         // ustaw pierwsze pole jako niezajete jesli za nim nie ma juz pionkow
         if (!children[1].isTaken)
         {
             children[0].isTaken = false;
         }
         // pozostałe pionki przesuń do przodu
         for (int i = 1; i < children.Length; i++)
         {
             pawn = children[i].GetComponentInChildren <PawnManager>();
             if (pawn != null)
             {
                 gameManager.MovePawn(pawn.gameObject, children[i - 1].gameObject);
             }
             if (i == children.Length - 1 || children[i + 1].GetComponentInChildren <PawnManager>() == null)
             // ustaw ostatnie pole z ktorego przesunieto pionek jako wolne
             {
                 children[i].isTaken = false;
                 break;
             }
         }
     }
 }
    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);
    }
예제 #11
0
 public static void Restart(bool restartNative = true)
 {
     if (restartNative)
     {
         SceneManager.LoadScene(SceneManager.GetActiveScene().name);
     }
     else
     {
         print(savePointPosition);
         PawnManager.TeleportPawn(savePointPosition, plrGameObject);
         UIController.StartLoadGame();
         plrGameObject.GetComponent <FirstPersonController>().IsPlrAllowMove = true;
         plrGameObject.GetComponent <HpController>().DefaultValues();
         if (cubesForReset.Count > 0 && !(cubesForReset == null))
         {
             foreach (var cube in cubesForReset)
             {
                 cube.GetComponent <CubeController>().ResetCubeColor();
             }
         }
     }
 }
예제 #12
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();
    }
예제 #13
0
 private void Start()
 {
     pawnStatus = PawnManager.ReadPawnStatus();
 }
예제 #14
0
 public void RunCubeLevel()
 {
     PawnManager.TeleportPawn(new Vector3(-334, 19, -86), GameManager.plrGameObject);
 }
예제 #15
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     GameEventManager.OnPawnSpawned += OnPawnSpawned;
     SpawnedEnemyCount = 0;
 }
예제 #16
0
 public void RunPortalLevel()
 {
     PawnManager.TeleportPawn(new Vector3(-269, 1.4f, -57), GameManager.plrGameObject);
 }
예제 #17
0
 public void RunBaseLevel()
 {
     PawnManager.TeleportPawn(new Vector3(7, 10, 9), GameManager.plrGameObject);
 }
예제 #18
0
 private void OnApplicationQuit()
 {
     ArcadeManager.WriteArcadeStatus();
     PawnManager.RecordTimeStamp();
     PawnManager.WritePawnStatus();
 }
예제 #19
0
 private void Awake()
 {
     instance = this;
 }
 public void RecordTimeStamp()
 {
     PawnManager.RecordTimeStamp();
 }