Пример #1
0
        private void OnRotate(SnakeCmd cmd)
        {
            float   rotSpeed = ((RotateCmd)cmd).rotParam.rotSpeed;
            Vector3 rot      = Vector3.up;

            transform.Rotate(rot * rotSpeed);
        }
Пример #2
0
        private void OnMove(SnakeCmd cmd)
        {
            float   moveSpeed = ((MoveCmd)cmd).moveParam.moveSpeed;
            Vector3 pos       = transform.position;

            pos += transform.forward * moveSpeed;
            transform.position = pos;
        }
Пример #3
0
        public void ExcAction(SnakeCmd cmd)
        {
            Action <SnakeCmd> func;

            if (_actions.TryGetValue(cmd.type, out func))
            {
                func?.Invoke(cmd);
            }
        }