Esempio n. 1
0
 // Create all systems
 public void initializeSystems()
 {
     gravSystem         = new GravitySystem(level); systems.Add(gravSystem);
     moveSystem         = new MovementSystem(level); systems.Add(moveSystem);
     playerSystem       = new PlayerMovementSystem(level); systems.Add(playerSystem);
     visSystem          = new VisionOrbSystem(level); systems.Add(visSystem);
     colSystem          = new CollisionDetectionSystem(level); systems.Add(colSystem);
     drawSystem         = new DrawSystem(level.g, level); systems.Add(drawSystem);
     healthSystem       = new HealthSystem(level); systems.Add(healthSystem);
     animSystem         = new AnimationSystem(level); systems.Add(animSystem);
     timerSystem        = new TimerSystem(level); systems.Add(timerSystem);
     timedShooterSystem = new TimedShooterSystem(level); systems.Add(timedShooterSystem);
     squishSystem       = new SquishSystem(level); systems.Add(squishSystem);
     inputSystem        = new InputSystem(level); systems.Add(inputSystem);
     scrEdgeSystem      = new ScreenEdgeSystem(level); systems.Add(scrEdgeSystem);
     slSystem           = new SwitchListenerSystem(level); systems.Add(slSystem);
     switchSystem       = new SwitchSystem(level); systems.Add(switchSystem);
     spSystem           = new SimplePowerUpSystem(level); systems.Add(spSystem);
     simpEnemySystem    = new SimpleEnemyAISystem(level); systems.Add(simpEnemySystem);
     weapSystem         = new PlayerWeaponSystem(level); systems.Add(weapSystem);
     bkgPosSystem       = new BackgroundPositionSystem(level); systems.Add(bkgPosSystem);
     debugSystem        = new DebugSystem(level); systems.Add(debugSystem);
     movPlatSystem      = new MovingPlatformSystem(level); systems.Add(movPlatSystem);
     grapSystem         = new GrappleSystem(level); systems.Add(grapSystem);
     pushSystem         = new PushableSystem(level); systems.Add(pushSystem);
     velZeroSystem      = new VelToZeroSystem(level); systems.Add(velZeroSystem);
     smushSystem        = new SmushSystem(level); systems.Add(smushSystem);
     signSystem         = new SignSystem(level); systems.Add(signSystem);
 }
    public void DeactivateForDuration(float duration)
    {
        deactivationTimer = new TimerSystem(duration, EndDeactivation);
        deactivationTimer.StartTimer();

        laserCollider.enabled = false;
    }
Esempio n. 3
0
 void Awake()
 {
     _timerSystem = this;
     simpleUpdates = new List<SimpleUpdate>();
     pendingSimple = new List<SimpleUpdate>();
     permaSimpleUpdates = new List<SimpleUpdate>();
 }
Esempio n. 4
0
    // Start is called before the first frame update
    void Start()
    {
        timerSystem = GameObject.Find("System").transform.Find("Timer System").GetComponent <TimerSystem>();

        TimerArea = GameObject.Find("TimerBar").transform.Find("bar").GetComponent <BoxCollider2D>().bounds;
        Meter     = (TimerArea.max.x - TimerArea.min.x) / 1000;
    }
Esempio n. 5
0
 private void Awake()
 {
     objectPos        = this.GetComponent <Transform>();
     canObjectMove    = true;
     boostTimerSystem = new TimerSystem();
     boostTimerSystem.ChangeTimerValue(maxSpeedBoostDuration);
     StartCoroutine(AvoidSoundOnStartCoroutine());
 }
Esempio n. 6
0
 void Start()
 {
     timer_system = gameObject.GetComponent <TimerSystem>();
     if (timer_system != null)
     {
         timer_system.AddTimer(step_timer);
     }
 }
    public void SetUpLifeSystem()
    {
        lifeSystem.OnReceivedDamages = OnReceivedDamages;
        lifeSystem.OnLifeReachedZero = Die;

        stunTimer       = new TimerSystem(onDamagedStunDuration, null);
        recoveringTimer = new TimerSystem(onDamagedRecoveringDuration, EndRecover);
    }
Esempio n. 8
0
    private void Start()
    {
        idleStartPos = transform.position;

        lootTimer = new TimerSystem(lootDuration, EndMovement);
        idleTimer = new TimerSystem(idleDuration, null);
        idleTimer.StartTimer();
        idleTimer.SetTime(Random.Range(0f, 1f));
    }
Esempio n. 9
0
    public void SetUp()
    {
        baseMovementValues = movementParameters.GetBaseMovementValues;
        barellRollValues   = movementParameters.GetBarellRollValues;

        barellRollDurationSystem = new TimerSystem(barellRollValues.GetBarellRollDuration, EndBarellRoll);
        barellRollCooldownSystem = new TimerSystem(barellRollValues.GetBarellRollCooldown, null);
        barellRollCurve          = barellRollValues.GetBarellRollCurve;
    }
Esempio n. 10
0
 public void Initialize(List <GameObject> player)
 {
     initializeTurnOrder(player);
     registerForEndOfTurn(player);
     GenerateTurnOrder();
     timer = this.gameObject.AddComponent <TimerSystem>();
     timer.Initialize();
     timer.setTurnSystem(this);
     timer.OnTimerExpired.AddListener(EndTurn);
 }
Esempio n. 11
0
 // Use this for initialization
 void Awake()
 {
     //meshRender.material.color = test.;
     //meshRender.material.pro
     meshRender.material = glowMaterials[0];
     DynamicGI.SetEmissive(meshRender, glowMaterials[0].color);
     //meshRender.material.EnableKeyword("_EMISSION");
     x        = Mathf.FloorToInt(transform.position.x / 2);
     y        = Mathf.FloorToInt(transform.position.z / 2);
     timersys = GetComponentInParent <TimerSystem>();
 }
Esempio n. 12
0
        /// <summary>
        /// Checks every spawner
        /// if on a timer, checks for the timers
        /// loads scenes if spawner is triggered
        /// </summary>
        /// <exception cref="NoTimerFoundException">If no timers are found while spawntype is timed</exception>
        protected override void OnUpdate()
        {
            Entities.ForEach((ref Spawner spawner) =>
            {
                var currentSpawner = spawner;

                if (spawner.spawnType == SpawnType.Timed)
                {
                    var timerArray = GetEntityQuery(typeof(Timer.Timer)).ToEntityArray(Allocator.Temp);
                    if (timerArray.Length == 0)
                    {
                        throw new NoTimerFoundException(currentSpawner.ID);
                    }
                    timerArray.Dispose();

                    Entities.ForEach((ref Timer.Timer timer) =>
                    {
                        if (timer.isMarkedDone && (timer.ID == currentSpawner.timerID))
                        {
                            currentSpawner.isTriggered = true;
                            TimerSystem.ResetTimer(timer.ID, Entities);
                        }
                    });
                }

                if ((!spawner.isTriggered && !currentSpawner.isTriggered) || spawner.isSpawningPaused)
                {
                    return;
                }
                switch (spawner.translationType)
                {
                case (TranslationType.Position):
                    SceneHandlerSystem.LoadSceneAsyncWithPosition(spawner.sceneReferenceToSpawn, false, Entities, spawner.spawnPos);
                    break;

                case (TranslationType.Offset):
                    SceneHandlerSystem.LoadSceneAsyncWithOffset(spawner.sceneReferenceToSpawn, false, Entities, spawner.spawnOffset);
                    break;

                case (TranslationType.PositionAndOffset):
                    SceneHandlerSystem.LoadSceneAsyncWithPositionAndOffset(spawner.sceneReferenceToSpawn, false, Entities, spawner.spawnPos, spawner.spawnOffset);
                    break;

                case TranslationType.None:
                    SceneHandlerSystem.LoadSceneAsync(spawner.sceneReferenceToSpawn, false, Entities);
                    break;

                default:
                    SceneHandlerSystem.LoadSceneAsync(spawner.sceneReferenceToSpawn, false, Entities);
                    break;
                }
                spawner.isTriggered = false;
            });
        }
Esempio n. 13
0
    public void PlayWinMusic()
    {
        crossFadingToSource        = winMusicSource;
        crossFadingToSource.volume = 0;
        crossFadingToSourceVolume  = winMusicVolume;
        crossFadingToSource.Play();

        crossFadeTimer = new TimerSystem();
        crossFadeTimer.ChangeTimerValue(winCrossFadeDuration);
        crossFadeTimer.StartTimer();
    }
Esempio n. 14
0
    WaitForSeconds revealDuration; // Duration of Reveal-State
    #endregion

    void Start()
    {
        timerSystem = GameObject.Find("System").transform.Find("Timer System").GetComponent <TimerSystem>();
        hitArea     = GameObject.Find("TimerBar").transform.Find("Hit Area").GetComponent <HitArea>();

        setGUI();

        setWaits();

        minValue              = 0; maxValue = 1000;
        needDelay             = true;
        optimizer_hideHitArea = true; optimizer_stopTimer = true; optimizer_fixDir = true;
    }
Esempio n. 15
0
 public void Reset()
 {
     _endGameSuccessOverlay.SetActive(false);
     _endGameNeutralOverlay.SetActive(false);
     _endGameFailureOverlay.SetActive(false);
     _endGameOverlay.SetActive(false);
     _timerText.transform.parent.gameObject.SetActive(true);
     _itemPanel.SetActive(true);
     _timerText.text = 0.ToString("d5");
     _teamSCoreOverlay.SetActive(false);
     _teamScoreText.text = 0.ToString("d5");
     _timerSystem        = null;
 }
Esempio n. 16
0
    // Start is called before the first frame update
    void Start()
    {
        timerSystem   = GameObject.Find("System").transform.Find("Timer System").GetComponent <TimerSystem>();
        gradeSystem   = GameObject.Find("System").transform.Find("Grade System").GetComponent <GradeSystem>();
        patternSystem = GameObject.Find("System").transform.Find("Pattern System").GetComponent <PatternSystem>();

        milkTimer = GameObject.Find("Timer GUI").GetComponent <TimerGUI>();
        hitArea   = GameObject.Find("TimerBar").transform.Find("Hit Area").GetComponent <HitArea>();

        RestartDelay = new WaitForSeconds(1f);

        Play_Milk();
    }
Esempio n. 17
0
        static int _m_Clear_xlua_st_(RealStatePtr L)
        {
            try {
                {
                    TimerSystem.Clear(  );



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 18
0
    public void SetUp(DamageTag dmgTag, bool instantiateWeapon)
    {
        currentShootParameters = baseWeaponParameters.GetShootParameters;
        cadenceTimerSystem     = new TimerSystem(currentShootParameters.GetShootCadence, null);

        serialShotTimerSystem = new TimerSystem(currentShootParameters.GetTimeBetweenEachSerialShot, EndShooting, currentShootParameters.GetNumberOfSerialShots - 1, Shoot);

        if (instantiateWeapon)
        {
            InstantiateBaseWeapon();
        }

        damageTag = dmgTag;
    }
Esempio n. 19
0
        static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 1)
                {
                    TimerSystem gen_ret = new TimerSystem();
                    translator.Push(L, gen_ret);

                    return(1);
                }
            }
            catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to TimerSystem constructor!"));
        }
Esempio n. 20
0
    public bool LaunchTeleportation()
    {
        if (!canTeleport)
        {
            return(false);
        }

        teleportationDurationSystem = new TimerSystem(teleportationDuration, EndTeleportation);
        teleportationDurationSystem.StartTimer();

        ChangeUsabilityState(UsabilityState.Using, ActionType.Special);
        SoundManager.Instance.PlaySound(Sound.PlayerTeleport, _player.transform.position);
        FxManager.Instance.CreateFx(FxType.playerTeleport, _player.transform.position);
        FxManager.Instance.CreateFx(FxType.playerTeleport, currentTeleportationPosition);

        return(true);
    }
Esempio n. 21
0
 private void OnTimerInvke()
 {
     if (onTimerCallback != null)
     {
         onTimerCallback.Invoke();
         if (loopTime == 0)
         {
             TimerSystem.Stop(onTimerCallback);
         }
     }
     else
     {
         onTimerWithArgCallback(arg);
         if (loopTime == 0)
         {
             TimerSystem.Stop(onTimerCallback);
         }
     }
 }
Esempio n. 22
0
        static int _m_OnTimerConstruct_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    TimerObject gen_ret = TimerSystem.OnTimerConstruct(  );
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 23
0
        static int _m_StopWithArg_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    System.Action <object> _onTimerWithArgCallback = translator.GetDelegate <System.Action <object> >(L, 1);

                    TimerSystem.StopWithArg(_onTimerWithArgCallback);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 24
0
        static int _m_OnTimerDisable_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    TimerObject _timerObject = (TimerObject)translator.GetObject(L, 1, typeof(TimerObject));

                    TimerSystem.OnTimerDisable(_timerObject);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
    private void Start()
    {
        jumpDurationSystem       = new TimerSystem(jumpMaxDuration, EndJumping);
        lateJumpDurationSystem   = new TimerSystem(lateJumpDelay, null);
        extentJumpDurationSystem = new TimerSystem(extentJumpDelay, null);

        shootingFrequenceSystem = new FrequenceSystem(bulletsPerSecond);
        shootingFrequenceSystem.SetUp(CheckForShootAgain);
        shootingFrequenceSystem.Stop();

        SetUpLifeSystem();

        // characterRenderer.material = normalMaterial;
        SetUpRenderer();

        /*walkStepFrequenceSystem = new FrequenceSystem(stepFeedbackPerSecond);
         * walkStepFrequenceSystem.SetUp(PlayFootFeedbackSound);*/

        //AudioManager.PlayAmbianceMusic();
        charaFlower.SetCurrentGlobalTarget(currentShootDirection == ShootDirection.Left ? leftShootPosition : rightShootPosition, currentShootDirection);
    }
Esempio n. 26
0
    IEnumerator DeathDissolve()
    {
        yield return(new WaitForSeconds(deathDisolveAnimationDelay));

        deathDissolveTimer = new TimerSystem(deathDisolveAnimationDuration, null);
        deathDissolveTimer.StartTimer();
        while (!deathDissolveTimer.TimerOver)
        {
            deathDissolveTimer.UpdateTimer();
            foreach (MeshRenderer mesh in meshesToDisolveOnDeath)
            {
                mesh.material.SetFloat("_DissolveAmount", Mathf.Lerp(0, deathDisolveMaxValue, disolveAnimationCurve.Evaluate(deathDissolveTimer.GetTimerCoefficient)));
            }

            foreach (SkinnedMeshRenderer mesh in skinnedMeshesToDisolveOnDeath)
            {
                mesh.material.SetFloat("_DissolveAmount", Mathf.Lerp(0, deathDisolveMaxValue, disolveAnimationCurve.Evaluate(deathDissolveTimer.GetTimerCoefficient)));
            }
            yield return(new WaitForEndOfFrame());
        }
    }
Esempio n. 27
0
        static int _m_Start_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 3 && translator.Assignable <System.Action>(L, 1) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))
                {
                    System.Action _onTImerCallback = translator.GetDelegate <System.Action>(L, 1);
                    float         _time            = (float)LuaAPI.lua_tonumber(L, 2);
                    float         _repeatRate      = (float)LuaAPI.lua_tonumber(L, 3);

                    TimerSystem.Start(_onTImerCallback, _time, _repeatRate);



                    return(0);
                }
                if (gen_param_count == 2 && translator.Assignable <System.Action>(L, 1) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
                {
                    System.Action _onTImerCallback = translator.GetDelegate <System.Action>(L, 1);
                    float         _time            = (float)LuaAPI.lua_tonumber(L, 2);

                    TimerSystem.Start(_onTImerCallback, _time);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to TimerSystem.Start!"));
        }
Esempio n. 28
0
        static int _m_StartWithArg_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    System.Action <object> _onTimerWithArgCallback = translator.GetDelegate <System.Action <object> >(L, 1);
                    float  _time       = (float)LuaAPI.lua_tonumber(L, 2);
                    float  _repeatRate = (float)LuaAPI.lua_tonumber(L, 3);
                    object _arg        = translator.GetObject(L, 4, typeof(object));

                    TimerSystem.StartWithArg(_onTimerWithArgCallback, _time, _repeatRate, _arg);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 29
0
        public void Wire(Node node, CachedNodeStateInfo state)
        {
            TimerSystem timerSystem = node.AddAndReturnChild(new TimerSystem());

            timerSystem.Name   = Utils.NormalizeMemberName(state.Name);
            timerSystem.Parent = node;

            // Field-Defined TimerReceivers
            foreach (TimerReceiverAttribute attribute in state.GetAttributes().OfType <TimerReceiverAttribute>())
            {
                timerSystem.AddTimer(attribute.TimeoutMethod, attribute.ProcessMode, attribute.WaitTime, attribute.OneShot,
                                     attribute.Autostart);
            }

            // Method-Defined TimerReceivers
            CachedNodeMethodInfo[] compatibleMethods = state.DeclaringType.GetMethods().Where(m => m.GetAttribute <TimerReceiverAttribute>() != null).ToArray();
            foreach (CachedNodeMethodInfo method in compatibleMethods)
            {
                TimerReceiverAttribute attribute = method.GetAttribute <TimerReceiverAttribute>();
                timerSystem.AddTimer(method.Name, attribute.ProcessMode, attribute.WaitTime, attribute.OneShot, attribute.Autostart);
            }

            state.SetValue(node, timerSystem);
        }
Esempio n. 30
0
 private static Stream <Signal> BounceAt(TimerSystem <double> sys,
                                         Cell <Signal> vel, Cell <Signal> pos, double target)
 {
     return(sys.At(pos.Map(p => p.When(target))).Snapshot(vel, (t, v) =>
                                                          new Signal(t, v.A, v.B, -v.ValueAt(t) * Restitution)));
 }
Esempio n. 31
0
 private static Stream<Signal> BounceAt(TimerSystem<double> sys,
     Cell<Signal> vel, Cell<Signal> pos, double target)
 {
     return sys.At(pos.Map(p => p.When(target))).Snapshot(vel, (t, v) =>
         new Signal(t, v.A, v.B, -v.ValueAt(t) * Restitution));
 }
Esempio n. 32
0
    private void Start()
    {
        outOfRangeTimerSystem = new TimerSystem(UIManager.Instance.maxOutOfFrameTime, null);

        SetUpWarning();
    }