Esempio n. 1
0
        public override WalkerBehaviour2D Transition(WalkerBehaviour2D new_behaviour)
        {
            WalkerBehaviour2D_Destination cast;

            if (new_behaviour.Convert(out cast))
            {
                if (navigator.IfNotNull(n => n.TryAlterDestination(cast.GetDestination())))
                {
                    return(this);
                }
            }

            return(new_behaviour);
        }
Esempio n. 2
0
        private void Start()
        {
            update_scheduler = new PeriodicWorkScheduler(
                this,
                () => WalkerSystem2D.GetInstance().GetUpdateInterval(),
                delegate() {
                if (behaviour != queued_behaviour)
                {
                    behaviour = behaviour.TransitionStart(
                        behaviour.IfNotNull(b => b.Transition(queued_behaviour), queued_behaviour),
                        b => b.Initialize(GetPosition())
                        );

                    queued_behaviour = behaviour;
                }

                is_moving = behaviour.IfNotNull(b => b.Update(GetPosition()));
            }
                );

            collider = new ComponentCache_Downward <Collider2D>(this);
        }
Esempio n. 3
0
        public void SetBehaviour(WalkerBehaviour2D new_behaviour)
        {
            queued_behaviour = new_behaviour;

            is_moving = true;
        }
Esempio n. 4
0
 public virtual WalkerBehaviour2D Transition(WalkerBehaviour2D new_behaviour)
 {
     return(new_behaviour);
 }