public void Coloring()
    {
        int            Id = SpawnerControl.getId();
        SpriteRenderer s;

        switch (Id)
        {
        //case 0 only for first white coloring
        case 0:
            s = GetComponent <SpriteRenderer>();
            SpawnerControl.setColor(s, Color.white);
            SpawnerControl.setId(1);
            break;

        default:
            if (Id < colorId.Length)
            {
                s = GetComponent <SpriteRenderer>();
                SpawnerControl.setColor(s, colorbank[colorId[Id]]);
                SpawnerControl.setId(Id + 1);
                Debug.Log(Id);
                Debug.Log("color id :" + colorId[Id]);
            }
            else
            {
                s = GetComponent <SpriteRenderer>();
                SpawnerControl.setColor(s, colorbank[colorId[1]]);
                SpawnerControl.setId(2);
                Debug.Log(Id);
                Debug.Log("color id Q :" + colorId[Id]);
            }
            break;
        }
    }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     //initializing variables
     score                  = 0;
     planetHealth           = 100;
     spawnerContainerScript = spawnerContainer.GetComponent <SpawnerControl>();
 }
    //checks whether the hint is unlocked for an element
    private bool?ElementHintIsUnlocked()
    {
        SpawnerControl spawnerControl = GetComponent <SpawnerControl>();

        if (spawnerControl == null)
        {
            return(null);
        }

        return(Utility.PlayerPrefIntToBool(spawnerControl.getCurrentElement().getName() + GlobalVars.HINT_STRING));
    }
Esempio n. 4
0
    // Start is called before the first frame update
    void Start()
    {
        //first block [white]
        StartCoroutine(Repeating(0, -1));

        //block iteration based on the data
        for (int i = 0; i < Width.Length; i++)
        {
            StartCoroutine(Repeating(totalTime, i));
            totalTime += (Width[i] / SpawnerControl.getRange());
        }
    }
    //checks whether the associated element in the tutorial is unlocked
    private bool?ElementIsUnlocked()
    {
        SpawnerControl spawnerControl = GetComponent <SpawnerControl>();

        //if this is not an element panel object with a SpawnerControl class attached
        if (spawnerControl == null || spawnerControl.getCurrentElement() == null)
        {
            return(null);
        }
        else
        {
            return(spawnerControl.getCurrentElement().isElementUnlocked());
        }
    }
    //checks whether the associated element in the tutorial is insufficent
    private bool?ElementIsInsufficent(int neededAmount)
    {
        SpawnerControl spawnerControl = GetComponent <SpawnerControl>();

        //if this is not an element panel object with a SpawnerControl class attached
        if (spawnerControl == null || spawnerControl.getCurrentElement() == null)
        {
            return(null);
        }
        else if (spawnerControl.getCurrentElement().GetInventoryCount() < neededAmount)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Esempio n. 7
0
    void BlockSpawn(int index)
    {
        Vector2 vct;

        switch (index)
        {
        //case -1 only spawn the first white block
        case -1:
            SpawnerControl.setSize(obj, 18, 0.5f);
            vct = new Vector2(transform.position.x - (18 / 2), -4);
            SpawnerControl.setPosition(obj, vct);
            Instantiate(obj);
            break;

        default:
            SpawnerControl.setSize(obj, Width[index], 0.5f);     //change value of height
            vct = new Vector2(transform.position.x + (Width[index] / 2), -4);
            SpawnerControl.setPosition(obj, vct);
            Instantiate(obj);
            break;
        }
    }