public void BuildSlime(GameObject _slime, SlimeBlueprint _blueprint)
 {
     slime          = _slime;
     slimeblueprint = _blueprint;
     tile.enabled   = true;
     gameManager.nodeList.Add(this);
 }
    private void TextSetting(SlimeBlueprint slime, int num)
    {
        if (prevNum != num)
        {
            ShopButtonReset(prevNum);
        }

        prevNum = num;
        shopButtons[num].SetShopButtonColor(yellowColor);
        shopButtons[num].ShopButtonPressed();
    }
    void Spawn_Size_1x2_Slime(SlimeBlueprint blueprint, Vector3 offset)
    {
        nodeList = new List <Node>();
        Vector3 buildOffset = CanBuild1x2(nodeList);

        if (buildOffset != Vector3.zero)
        {
            _slime = PhotonNetwork.Instantiate(blueprint.slimePrefab.name, GetBuildPos(buildOffset + offset), Quaternion.identity, 0);

            for (int i = 0; i < nodeList.Count; i++)
            {
                nodeList[i].BuildSlime(_slime, blueprint);
                nodeList[i].nodeList = nodeList.ToList();
            }
        }
    }
    void SpawnSlime(SlimeBlueprint blueprint)
    {
        //Check Player Cost > slime money -> can build
        if (PlayerStats.playerCost < blueprint.cost)
        {
            return;
        }

        int     size   = blueprint.size;
        Vector3 offset = blueprint.spawnPosOffset;

        switch (size)
        {
        case 1:
            buildPosition = GetBuildPos(offset);
            _slime        = PhotonNetwork.Instantiate(blueprint.slimePrefab.name, buildPosition, Quaternion.identity, 0);
            BuildSlime(_slime, blueprint);
            break;

        case 2:
            Spawn_Size_1x2_Slime(blueprint, offset);
            break;

        case 4:
            Spawn_Size_2x2_Slime(blueprint, offset);
            break;

        default:
            break;
        }

        if (slime)
        {
            playerStats.PurchaseSlime(blueprint.cost);
            PlayerShop.Instance.ButtonsUpdate();
        }

        //Building effect
    }
    // Use this for initialization
    void Start()
    {
        /* Create Player Shop's monster builds */
        for (int i = 0; i < blueprint.Length; i++)
        {
            if (pDeck.deck[i] != null)
            {
                blueprint[i] = new SlimeBlueprint(pDeck.deck[i], GetShopPrefab(i));
                int    cost   = blueprint[i].cost;
                Sprite sprite = PhotonNetwork.isMasterClient ? blueprint[i].icon_red : blueprint[i].icon_blue;
                int    size   = blueprint[i].size;

                shopButtons[i].SetupShopButton(cost, sprite, size);
            }
            else
            {
                blueprint[i] = null;
                shopButtons[i].SetShopButtonInteractable(false);
            }
        }
        /* Update Shop buttons by cheching player's money */
        ButtonsUpdate();
    }
Example #6
0
 public void ClearSlimeToSpawn()
 {
     slimeToSpawn = null;
 }
Example #7
0
 public void SelectSlimeToSpawn(SlimeBlueprint slime)
 {
     slimeToSpawn = slime;
 }