Ejemplo n.º 1
0
    /*Sets up random vars to generate the level
     */
    public Groundgenerator(GameObject[] gameObjects)
    {
        foreach (GameObject gObject in gameObjects)
        {
            ItemTypes itemtype = gObject.GetComponent <ObjectStatsInterface>().getType();
            if (itemtype.Equals(ItemTypes.FLOOR))
            {
                floor_Scale = gObject.transform.localScale;
                FillPositionsArray(floor_Scale.x);
            }
            if (gObject.GetComponent <ObjectStatsInterface>().getObjectClass().Equals(ObjectClass.OBSTACLE))
            {
                KeyValuePair <ItemTypes, Vector2> temp = new KeyValuePair <ItemTypes, Vector2>(itemtype,
                                                                                               gObject.GetComponent <ObstacleInterface>().GetPositionAndHeight());

                if (!randomObjectsToSpawn.Contains(temp))
                {
                    randomObjectsToSpawn.Add(temp);
                }
            }
        }
        god = ObjectPooler.instance;
        god.setGameObjects(gameObjects);
        SetNewVariables();
    }
Ejemplo n.º 2
0
    public void HandleObjects(ItemTypes item, Vector3 position, int newValue)
    {
        GameObject temp = god.getOutOfObjectPool(item);

        if (temp != null && item.Equals(ItemTypes.COIN))
        {
            temp.SetActive(true);
            temp.GetComponent <CoinInterface>().setValue(newValue);
            temp.transform.position = position;
            temp.transform.rotation = Quaternion.Euler(0, 0, 0);
        }
    }