Esempio n. 1
0
    public void ExecuteInitialSpawnRule()
    {
        if (initialTileSpawnRule != null)
        {
            List <RuleEntry>     tempRuleEntryList;
            List <TileSpawnRule> immediateSpawnList = Match3BoardGameLogic.Instance.immediateSpawnList;

            //Check immediateSpawnList for available rules that can be applied, with respect to the eligibleSpawnList.
            for (int i = 0; i < immediateSpawnList.Count; i++)
            {
                if (eligibleSpawnList != null && eligibleSpawnList.Count > 0)
                {
                    tempRuleEntryList = immediateSpawnList[i].CompareRuleEntries(eligibleSpawnList);
                    immediateSpawnList.RemoveAt(i);
                }
                else
                {
                    tempRuleEntryList = immediateSpawnList[i].ruleEntries;
                }

                if (tempRuleEntryList != null)
                {
                    initialTileSpawnRule.ruleEntries = tempRuleEntryList;
                    break;
                }
            }

            // Execute the initial spawn rule only if we have at least one RuleEntry.
            if (initialTileSpawnRule.ruleEntries.Count > 0)
            {
                Match3Tile newTile = initialTileSpawnRule.SpawnNewTile(true);
                Match3BoardRenderer.Instance.AttachTileToBoardAt(this, newTile, false, true);
            }
        }
    }
Esempio n. 2
0
    protected void SpawnNewTileInQueue(TileSpawnRule spawnRule)
    {
        Match3Tile newTile = spawnRule.SpawnNewTile();

        newTile.LocalPosition = spawnPoint;

        // Deactivate and hide the tile until the spawn queue is processed.
        newTile.gameObject.SetActive(false);

        spawnQueue.Enqueue(newTile);

        if (!isSpawnQueueUpdating)
        {
            StartCoroutine(ProcessSpawnQueue());
        }
    }
	protected void SpawnNewTileInQueue(TileSpawnRule spawnRule)
	{
		Match3Tile newTile = spawnRule.SpawnNewTile();
		newTile.LocalPosition = spawnPoint;
		
		// Deactivate and hide the tile until the spawn queue is processed.
		newTile.gameObject.SetActive(false);

		spawnQueue.Enqueue(newTile);
		
		if ( !isSpawnQueueUpdating )
		{
			StartCoroutine(ProcessSpawnQueue());
		}
	}