Example #1
0
        protected override void Run(Unit entity, Turn_Map message)
        {
            ///ToTo 直接转发给所有 客户端
            Vector3 dirPos = new Vector3(message.X, message.Y, message.Z);

            Console.WriteLine(" Turn_MapHandler-20-dirPos: " + dirPos.ToString());

            M2C_KeyboardDirection m2C_KeyboardDirection = new M2C_KeyboardDirection();

            m2C_KeyboardDirection.X  = dirPos.x;
            m2C_KeyboardDirection.Y  = dirPos.y;
            m2C_KeyboardDirection.Z  = dirPos.z;
            m2C_KeyboardDirection.Id = entity.Id;

            MessageHelper.Broadcast(m2C_KeyboardDirection, entity.GetComponent <AoiUnitComponent>().playerIds.MovesSet.ToArray());
        }
Example #2
0
        public async ETVoid StartTurn(M2C_KeyboardDirection message)
        {
            Debug.Log(" UnitAnglersComponent-21-angles: " + message.Y + " / " + message.Ys[0]);

            // 取消之前的移动协程
            this.CancellationTokenSource?.Cancel();
            this.CancellationTokenSource = new CancellationTokenSource();

            this.Path.Clear();
            for (int i = 0; i < message.Xs.Count; ++i)
            {
                this.Path.Add(new Vector3(message.Xs[i], message.Ys[i], message.Zs[i]));
            }
            ServerEul = new Vector3(message.X, message.Y, message.Z);

            await StartTurn(this.CancellationTokenSource.Token);

            this.CancellationTokenSource.Dispose();
            this.CancellationTokenSource = null;
        }