Ejemplo n.º 1
0
 void IStatus.Enter()
 {
     _DatumPosition = _Player.GetPosition();
     _Player.Aid();
     _Caster = SkillCaster.Build(ACTOR_STATUS_TYPE.AID);
     _TimeCounter.Reset();
 }
Ejemplo n.º 2
0
    private void OnCollisionEnter(Collision collision)
    {
        if (_CollisionCooldown.Ticks < _CooldownTicks)
        {
            return;
        }
        var obs = this.GetComponent <Obstacle>();

        if (obs != null && Game.PlayerState.CurrentState == State.Big && obs.Type == Obstacle.TYPE.可撞破)
        {
            //this.GetComponent<MeshCollider>().isTrigger = true;
            //this.transform.parent.gameObject.GetComponent<MeshCollider>().isTrigger = true;
            // this.GetComponent<Material>().DOColor(new Color(0,0,0,0), 0.1f).OnStart(()=> {}).OnComplete(() => { });
            this.transform.parent.gameObject.SetActive(false);
            return;
        }
        var rig = collision.gameObject.GetComponent <Rigidbody>();

        rig.velocity = Vector3.zero;
        var speed = collision.gameObject.GetComponent <PlayerState>().Speed;

        rig.AddForce(transform.forward * Force * speed, ForceMode.Impulse);

        //  Game.Camera.GetComponent<LookAt>().currentStage = gameObject.transform.position;

        _CollisionCooldown.Reset();
    }
Ejemplo n.º 3
0
        public void Operate(long busy)
        {
            _FPS.Update();

            if (_Busy <= busy && _FPS.Value > _LowPower)
            {
                _SpinWait.SpinOnce();
                _SpinCount++;
            }
            else
            {
                _SpinWait.Reset();
                _WorkCount++;
            }

            if (_TimeCount.Second > _Sample)
            {
                Power = _WorkCount / (_WorkCount + _SpinCount);

                _WorkCount = 0;
                _SpinCount = 0;
                _TimeCount.Reset();
            }

            _Busy = busy;
        }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        var delta = _DeltaTime.Second;

        _DeltaTime.Reset();
        _UpdateAnimator();

        var offsetRotY = Trun * delta;


        Root.Rotate(new Vector3(0, offsetRotY, 0));
        Root.Translate(Vector3.right * Speed * delta);
        Root.position = Root.position + (SkillOffset * delta);

        //Debug.DrawRay(ProbeOrigin.position , ProbeOrigin.right, Color.yellow , _ProbeLength);

        if (_Light != null && _Visible != null)
        {
            _Light.range = _Visible.View;
            if (IsMainActor())
            {
                /*RenderSettings.fog= true;
                 * RenderSettings.fogColor = Color.red;
                 * RenderSettings.fogMode = FogMode.Linear;
                 * RenderSettings.fogDensity = 1;
                 * RenderSettings.fogStartDistance = 0;*/
                RenderSettings.fogEndDistance = _Visible.View;
            }
        }
    }
Ejemplo n.º 5
0
        void IStage.Enter()
        {
            _Binder.Bind <ICastSkill>(this);

            _Player.SetSkillVelocity(_Caster.GetShiftDirection(), _Caster.GetShiftSpeed());
            _Player.CastBegin(_Caster.Data.Id);

            _MoveController.Backward   = _Caster.GetBackward();
            _MoveController.Forward    = _Caster.GetForward();
            _MoveController.RunForward = _Caster.GetRunForward();
            _MoveController.TurnLeft   = _Caster.GetTurnLeft();
            _MoveController.TurnRight  = _Caster.GetTurnRight();

            _Binder.Bind <IMoveController>(_MoveController);

            if (_Caster.CanDisarm())
            {
                _Binder.Bind <IBattleSkill>(this);
            }

            _CastTimer.Reset();

            _DatumPosition = _Player.GetPosition();
            var strength = _Player.Strength(-_Caster.Data.StrengthCost);

            _Overdraft = strength < 0.0f;
        }
 public void Show(string s)
 {
     Text.text = s;
     Image.gameObject.SetActive(true);
     Text.gameObject.SetActive(true);
     _Counter.Reset();
 }
Ejemplo n.º 7
0
 // Update is called once per frame
 void Update()
 {
     if (_TimeCounter.Second >= 1.0f && _Online != null)
     {
         Text.text = _Online.Ping.ToString();
         _TimeCounter.Reset();
     }
 }
Ejemplo n.º 8
0
 public void Update()
 {
     _Frames++;
     if (_Counter.Second > 1.0f)
     {
         Value   = _Frames;
         _Frames = 0;
         _Counter.Reset();
     }
 }
Ejemplo n.º 9
0
        bool IUpdatable.Update()
        {
            var second = _DeltaTimeCounter.Second;

            _LastDelta = second;
            _DeltaTimeCounter.Reset();

            _Tree.Tick(second);
            _Update(second);

            return(true);
        }
Ejemplo n.º 10
0
        void IStage.Update()
        {
            _Status.Update();

            var damage = _Player.HaveDamage();

            _ProcessDamage(damage);

            var deltaTime = _TimeCounter.Second;

            _TimeCounter.Reset();
            _Player.RecoveryStrength(deltaTime);
            _Player.RecoveryHealth(deltaTime);
        }
Ejemplo n.º 11
0
    private void OnCollisionEnter(Collision collision)
    {
        if (_CollisionCooldown.Ticks < _CooldownTicks)
        {
            return;
        }

        var rig = gameObject.GetComponent <Rigidbody>();

        rig.velocity = Vector3.zero;
        rig.AddForce(Force, ForceMode.Impulse);

        _CollisionCooldown.Reset();
    }
Ejemplo n.º 12
0
    private void OnCollisionEnter(Collision collision)
    {
        if (_CollisionCooldown.Ticks < _CooldownTicks)
        {
            return;
        }
        var direction = collision.gameObject.GetComponent <MoveDirection>();

        if (direction == null)
        {
            return;
        }

        Force = direction.Force;
        _CollisionCooldown.Reset();
    }
Ejemplo n.º 13
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     _Counter.Reset();
 }
Ejemplo n.º 14
0
        private static void _UpdateProxy(object obj)
        {
            var weak = (WeakReference<Proxy>)obj;

            var spin = new SpinWait();

            var counter = new TimeCounter();
            while(true)
            {
                Proxy proxy;

                if(weak.TryGetTarget(out proxy) == false)
                {
                    break;
                }

                if(proxy.Enable == false)
                {
                    break;
                }

                IUpdatable updater = proxy;
                updater.Update();
                updater = null;
                proxy = null;
                if(counter.Second >= 1.0f)
                {
                    GC.Collect();
                    counter.Reset();
                }
            }
        }
Ejemplo n.º 15
0
 public override void Update()
 {
     _ResponseItems(_TimeCounter.Second);
     _TimeCounter.Reset();
 }
Ejemplo n.º 16
0
    IEnumerator _QueryResult(System.Action <Suit[]> suit_callback)
    {
        var propertyValues = _Conditions;// (from c in _Conditions select new BladeAndSoulGossipCards.PropertyValue { Id = c.Id, Value = c.Value }).ToArray();

        //BladeAndSoulGossipCards.CardSet set = BladeAndSoulGossipCards.CardSet.Instance;
        var cards = BladeAndSoulGossipCards.CardSet.Instance.Filter(_Cards, propertyValues);

        Card[] cards1 = cards.Assort(1).Fill(CardSet.Instance, 1);
        Card[] cards2 = cards.Assort(2).Fill(CardSet.Instance, 2);
        Card[] cards3 = cards.Assort(3).Fill(CardSet.Instance, 3);
        Card[] cards4 = cards.Assort(4).Fill(CardSet.Instance, 4);
        Card[] cards5 = cards.Assort(5).Fill(CardSet.Instance, 5);
        Card[] cards6 = cards.Assort(6).Fill(CardSet.Instance, 6);
        Card[] cards7 = cards.Assort(7).Fill(CardSet.Instance, 7);
        Card[] cards8 = cards.Assort(8).Fill(CardSet.Instance, 8);
        Regulus.Utility.TimeCounter timeCounter = new Regulus.Utility.TimeCounter();
        List <Suit> suits = new List <Suit>();

        CalculationAmount = cards1.Count() * cards2.Count() * cards3.Count() * cards4.Count() * cards5.Count() * cards6.Count() * cards7.Count() * cards8.Count();
        CalculationCount  = 0;
        Property[] propertys = propertyValues.ToArray();
        foreach (var card1 in cards1)
        {
            foreach (var card2 in cards2)
            {
                foreach (var card3 in cards3)
                {
                    foreach (var card4 in cards4)
                    {
                        foreach (var card5 in cards5)
                        {
                            foreach (var card6 in cards6)
                            {
                                foreach (var card7 in cards7)
                                {
                                    foreach (var card8 in cards8)
                                    {
                                        if (timeCounter.Second > 1.0f / 30.0f)
                                        {
                                            timeCounter.Reset();

                                            var orders = suits.OrderBy((suit) => suit.GetValue(propertys[0]));
                                            foreach (var property in propertys.Skip(1))
                                            {
                                                orders = orders.ThenBy((suit) => suit.GetValue(property));
                                            }

                                            suits = orders.ToList();

                                            if (suits.Count > 30)
                                            {
                                                suits.RemoveRange(0, suits.Count - 30);
                                            }

                                            yield return(new WaitForEndOfFrame());
                                        }

                                        var s = new Suit(card1, card2, card3, card4, card5, card6, card7, card8);

                                        bool pass = (from filter in propertyValues
                                                     where s.GetValue(filter) < filter.Value
                                                     select false).Count() == 0;

                                        if (pass)
                                        {
                                            suits.Add(s);
                                        }
                                        CalculationCount++;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        var result = suits.OrderByDescending((suit) => suit.GetValue(propertys[0]));

        foreach (var property in propertys.Skip(1))
        {
            result = result.ThenByDescending((suit) => suit.GetValue(property));
        }


        suit_callback(result.ToArray());

        yield return(new WaitForEndOfFrame());
    }
Ejemplo n.º 17
0
 void IStatus.Enter()
 {
     _Player.Stun();
     _Counter.Reset();
 }
Ejemplo n.º 18
0
 void IStage.Enter()
 {
     _Counter.Reset();
 }