Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        camera = FindObjectOfType <Camera>();
        ag     = FindObjectOfType <ArtGallery>();
        slots  = new List <FunctionSlot>();

        hud = HUD.GetComponent <HUD>();
        hud.AddSlots(tray, numberOfFunctionSlots);
        ActiveSlot = 0;
        hud.SelectSlot(tray, ActiveSlot);
        functions = new IFunctionItem[numberOfFunctionSlots];

        ag.player.functions = this;

        /*** TESTING SECTION
         * Adding functions to the hud ***/
        SavedFunction testFunction0 = new SavedFunction
        {
            fTYPE = FTYPE.ID,
        };

        testFunction0.GenerateThumbnail();
        AddFunction(testFunction0);
        //CycleActiveSlot(1);
        //SavedFunction testFunction1 = new SavedFunction
        //{
        //    fTYPE = FTYPE.GAUSS,
        //};
        //testFunction1.GenerateThumbnail();
        //AddFunction(testFunction1);
        //CycleActiveSlot(1);
        //SavedFunction testFunction2 = new SavedFunction
        //{
        //    fTYPE = FTYPE.SINE,
        //};
        //testFunction2.GenerateThumbnail();
        //AddFunction(testFunction2);
        //CycleActiveSlot(1);
        //SavedFunction testFunction3 = new SavedFunction
        //{
        //    fTYPE = FTYPE.SAWTOOTH,
        //};
        //testFunction3.GenerateThumbnail();
        //AddFunction(testFunction3);
        //CycleActiveSlot(1);
        //SavedFunction testFunction4 = new SavedFunction
        //{
        //    fTYPE = FTYPE.SQUAREWAVE,
        //};
        //testFunction4.GenerateThumbnail();
        //AddFunction(testFunction4);
        //CycleActiveSlot(1);
    }
Ejemplo n.º 2
0
    public bool HasFunction(SavedFunction comapre)
    {
        bool result = false;

        foreach (SavedFunction sf in functions)
        {
            if (sf != null && sf.fTYPE == comapre.fTYPE)
            {
                result = true;
                break;
            }
        }

        return(result);
    }
Ejemplo n.º 3
0
    private void SpawnPickups()
    {
        FTYPE fTYPE = ag.GetRandomCollectedFunction();

        if ((UnityEngine.Random.Range(0f, 1f) < ag.functionSpawnRate &&
             !ag.FunctionIsActive(fTYPE)) || ag.ActivateFunctionsEmpty())
        {
            GameObject     functionPickup = Instantiate(functionPickupObject) as GameObject;
            FunctionPickup fp             = functionPickup.GetComponent <FunctionPickup>();
            SavedFunction  sf             = new SavedFunction
            {
                fTYPE = fTYPE
            };
            sf.GenerateThumbnail();
            fp.Function = sf;
        }
    }