//LateUpdate

        private void LateUpdate()
        {
            _currentSequence = UpdateSequence.LateUpdate;
            if (EarlyLateUpdate != null)
            {
                EarlyLateUpdate(this, System.EventArgs.Empty);
            }
        }
        private void _tardyUpdateHook_LateUpdate(object sender, System.EventArgs e)
        {
            if (TardyLateUpdate != null)
            {
                TardyLateUpdate(this, e);
            }

            //Track exit of update loop
            _currentSequence = UpdateSequence.None;
        }
Exemplo n.º 3
0
        private void DoUpdate(UpdateSequence updateType)
        {
            this.LockTweenSet();

            var e = _runningTweens.GetEnumerator();

            while (e.MoveNext())
            {
                if (e.Current.UpdateType == updateType)
                {
                    e.Current.Update();
                }
            }

            this.UnlockTweenSet();
        }
        //Fixed Update

        private void FixedUpdate()
        {
            //Track entry into fixedupdate loop
            _currentSequence = UpdateSequence.FixedUpdate;

            if (_internalEarlyUpdate != null)
            {
                _internalEarlyUpdate(true);
            }

            _fixedInvokePump.Update();

            if (EarlyFixedUpdate != null)
            {
                EarlyFixedUpdate(this, System.EventArgs.Empty);
            }
        }
        //Update

        private void Update()
        {
            //Track entry into update loop
            _currentSequence = UpdateSequence.Update;

            if (_internalEarlyUpdate != null)
            {
                _internalEarlyUpdate(false);
            }

            _invokePump.Update();

            if (EarlyUpdate != null)
            {
                EarlyUpdate(this, System.EventArgs.Empty);
            }
        }
 ITweenHash ITweenHash.Use(UpdateSequence type)
 {
     return this.Use(type);
 }
 public TweenHash Use(UpdateSequence type)
 {
     _updateType = type;
     return(this);
 }
 ITweenHash ITweenHash.Use(UpdateSequence type)
 {
     return(this.Use(type));
 }
 public TweenHash UseFixedUpdate()
 {
     _updateType = UpdateSequence.FixedUpdate;
     return(this);
 }
 public TweenHash UseLateUpdate()
 {
     _updateType = UpdateSequence.LateUpdate;
     return(this);
 }
 public TweenHash UseUpdate()
 {
     _updateType = UpdateSequence.Update;
     return this;
 }
        //Update

        private void Update()
        {
            //Track entry into update loop
            _currentSequence = UpdateSequence.Update;

            if (_internalEarlyUpdate != null) _internalEarlyUpdate(false);

            _invokePump.Update();

            if (EarlyUpdate != null) EarlyUpdate(this, System.EventArgs.Empty);
        }
        //Fixed Update

        private void FixedUpdate()
        {
            //Track entry into fixedupdate loop
            _currentSequence = UpdateSequence.FixedUpdate;

            if (_internalEarlyUpdate != null) _internalEarlyUpdate(true);

            _fixedInvokePump.Update();

            if (EarlyFixedUpdate != null) EarlyFixedUpdate(this, System.EventArgs.Empty);
        }
Exemplo n.º 14
0
 /// <summary>
 /// Establece el metodo de actualización de las neuronas 
 /// </summary>
 /// <param name="updSequence">Metodo a utilizar</param>
 public void SetUpdSequence(UpdateSequence updSequence)
 {
     UpdSequence = updSequence;
 }
 ITweenHash ITweenHash.Use(UpdateSequence type)
 {
     this.UpdateType = type;
     return this;
 }
Exemplo n.º 16
0
 ITweenHash ITweenHash.Use(UpdateSequence type)
 {
     this.UpdateType = type;
     return(this);
 }
Exemplo n.º 17
0
        /// <summary>
        /// Sets specified initial state and runs networks dynamics
        /// </summary>
        /// <param name="initialState">A list of neurons which determines an initional state</param>
        /// <param name="triggerEnergyChange">A boolean indicating if it should trigger the energyChange event</param>
        public void Run(List<Neuron> initialState, List<double> heightMap, UpdateSequence updSequence, bool triggerEnergyChange = false)
        {
            this.Neurons = initialState;
            bool isChanging = true;
            while (isChanging)
            {
                isChanging = false;
                var newState = this.Neurons;
                for (int i = 0; i < NeuronsCount; i++)
                {
                    int neuronHeight = 0;
                    if (updSequence == UpdateSequence.PseudoRandom)
                    {
                        var jArray = Enumerable.Range(0, NeuronsCount).ToArray();
                        ShuffleArray(jArray);
                        for (int j = 0; j < NeuronsCount; j++)
                            neuronHeight += Matrix[i, jArray[j]] * (newState[j].State);
                    }
                    else if (updSequence == UpdateSequence.Sequential)
                    {
                        for (int j = 0; j < NeuronsCount; j++)
                            neuronHeight += Matrix[i, j] * (newState[j].State);
                    }
                    else if (updSequence == UpdateSequence.Synchronous)
                    {
                        for (int j = 0; j < NeuronsCount; j++)
                            neuronHeight += Matrix[i, j] * (Neurons[j].State);
                    }

                    double neuronMapHeight = 0;
                    if (heightMap != null)
                        neuronMapHeight = heightMap[i];

                    if (newState[i].ChangeState(neuronHeight + neuronMapHeight))
                    {
                        isChanging = true;
                        if (triggerEnergyChange)
                        {
                            CalculateEnergy(newState);
                            OnEnergyChanged(new EnergyEventArgs(Energy, i));
                        }
                    }
                }
                this.Neurons = newState;
            }
            CalculateEnergy(this.Neurons);
        }
        private void _tardyUpdateHook_LateUpdate(object sender, System.EventArgs e)
        {
            if (TardyLateUpdate != null) TardyLateUpdate(this, e);

            //Track exit of update loop
            _currentSequence = UpdateSequence.None;
        }
        //LateUpdate

        private void LateUpdate()
        {
            _currentSequence = UpdateSequence.LateUpdate;
            if (EarlyLateUpdate != null) EarlyLateUpdate(this, System.EventArgs.Empty);
        }
 public TweenHash Use(UpdateSequence type)
 {
     _updateType = type;
     return this;
 }
Exemplo n.º 21
0
        private void DoUpdate(UpdateSequence updateType)
        {
            _inUpdate = true;

            float dt;
            Tweener twn;
            for (int i = 0; i < _runningTweens.Count; i++)
            {
                twn = _runningTweens[i];
                if (twn.UpdateType != updateType) continue;

                twn.Update();
            }

            _inUpdate = false;

            for(int i = 0; i < _toRemove.Count; i++)
            {
                this.RemoveReference_Imp(_toRemove[i]);
            }
            _toRemove.Clear();
            for(int i = 0; i < _toAdd.Count; i++)
            {
                this.AddReference_Imp(_toAdd[i]);
            }
            _toAdd.Clear();
        }