Esempio n. 1
0
        public LineEntity Add(DotEntity d1, DotEntity d2)
        {
            var entity = new LineEntity(d1, d2);
            var list   = this._state.lines.Value;

            list.Add(entity);
            this._state.lines.SetValueAndForceNotify(list);
            return(entity);
        }
Esempio n. 2
0
        public DotEntity Add(int lane, Vector3 localPosition)
        {
            var id     = this._state.dots.Value.Count + 1;
            var entity = new DotEntity(id, lane, localPosition);
            var list   = this._state.dots.Value;

            list.Add(entity);
            this._state.dots.SetValueAndForceNotify(list);
            return(entity);
        }
Esempio n. 3
0
        public void Enter(DotEntity dot)
        {
            var list = this._state.lines.Value;

            // find line
            var player = this._state.player.Value;
            var line   = list.Find(it => it.HasDot(dot.id));

            if (line == null)
            {
                return;
            }
            if (!line.IsOnLane(player.lane))
            {
                return;
            }

            // update player lane
            player.lane = line.GetOppositeLane(player.lane);
            this._state.player.Value = player;
        }
Esempio n. 4
0
 private void Awake()
 {
     this._entity = GlobalReducers.dots.Add(lane, this.transform.localPosition);
     this.id      = this.Entity.id;
 }