示例#1
0
    private void ProcessUseless()
    {
        StartLoopTrigger start = _StartTrigger.First().GetComponent <StartLoopTrigger>();

        foreach (GameObject go in _ToRepop)
        {
            GameObjectManager.addComponent <Removed>(go);

            Origin origin          = go.GetComponent <Origin>();
            YellowPageComponent yp = _YellowPages.First().GetComponent <YellowPageComponent>();
            start.deckPool.Add(YellowPageUtils.GetSourceObject(yp, origin.sourceObjectKey));
        }
    }
示例#2
0
 public LoopSystem()
 {
     foreach (GameObject triggerVolume in _StartTriggerGO)
     {
         StartLoopTrigger triggerComp = triggerVolume.GetComponent <StartLoopTrigger>();
         triggerComp.deckPool.Shuffle <GameObject>();
     }
     foreach (GameObject triggerVolume in _InGO)
     {
         InLoopTrigger triggerComp = triggerVolume.GetComponent <InLoopTrigger>();
         triggerComp.initialSpeedMult = triggerComp.speedMult;
     }
 }
    // ======================================
    // ========== PUBLIC FUNCTIONS ==========
    // ======================================
    public LevelManagerSystem()
    {
        manager = singletonManager.First().GetComponent <LevelManager>();

        if (!manager)
        {
            Debug.LogError("No manager in Scene");
            return;
        }

        manager.nextLevel.onClick.AddListener(nextState);
        refreshState();
        cachedState = manager.state;

        // Setup pool
        spawner              = manager.bloodVessel.GetComponent <StartLoopTrigger>();
        spawner.deckPool     = Global.player.levelDeck;
        spawner.randomGoPool = Global.data.currentRandomGos;
    }
示例#4
0
    // Use to process your families.
    protected override void onProcess(int familiesUpdateCount)
    {
        foreach (GameObject triggerVolume in _StartTriggerGO)
        {
            StartLoopTrigger triggerComp = triggerVolume.GetComponent <StartLoopTrigger>();
            if (triggerComp.deckPool.Count > 0)
            {
                triggerComp.cooldownDeck -= Time.deltaTime;
                if (triggerComp.cooldownDeck <= 0)
                {
                    triggerComp.cooldownDeck = triggerComp.deckRate;
                    GameObject prefab = triggerComp.deckPool.Pop <GameObject>();

                    // Instanciate the GameObject
                    GameObject go = Object.Instantiate(prefab);
                    go.SetActive(true);

                    // Bind it to FYFY
                    GameObjectManager.bind(go);

                    // Set GameObject's position
                    go.transform.position = randomStartPosition(triggerVolume);
                }
            }

            if (triggerComp.randomGoPool.Count > 0)
            {
                triggerComp.cooldownRandom -= Time.deltaTime;
                if (triggerComp.cooldownRandom <= 0)
                {
                    triggerComp.cooldownRandom = triggerComp.randomGoRate;
                    GameObject prefab = triggerComp.randomGoPool.Pop <GameObject>();

                    // Instanciate the GameObject
                    GameObject go = Object.Instantiate(prefab);
                    go.SetActive(true);

                    // Bind it to FYFY
                    GameObjectManager.bind(go);

                    // Set GameObject's position
                    go.transform.position = randomStartPosition(triggerVolume);
                }
            }
        }

        foreach (GameObject triggerVolume in _InTriggerGO)
        {
            InLoopTrigger triggerComp = triggerVolume.GetComponent <InLoopTrigger>();
            Triggered3D   triggered   = triggerVolume.GetComponent <Triggered3D>();
            foreach (GameObject go in triggered.Targets)
            {
                MoveToward moveToward = go.GetComponent <MoveToward>();
                if (moveToward)  // Immuno layer
                {
                    moveToward.useOverride   = true;
                    moveToward.overrideSpeed = triggerComp.speedMult;
                }

                if (moveToward && moveToward.target != triggerComp.target.position && go.layer != 11) // Immuno layer
                {
                    moveToward.target = triggerComp.target.position;
                }
            }
        }

        foreach (GameObject triggerVolume in _EndTriggerGO)
        {
            EndLoopTrigger triggerComp = triggerVolume.GetComponent <EndLoopTrigger>();
            Triggered3D    triggered   = triggerVolume.GetComponent <Triggered3D>();
            foreach (GameObject go in triggered.Targets)
            {
                go.transform.position = randomStartPosition(triggerComp.teleport);
            }
        }
    }