Esempio n. 1
0
        public void UpdateHitBox(IGameEntity gameEntity)
        {
            var position        = gameEntity.Position.Value;
            var rotation        = gameEntity.GetComponent <OrientationComponent>().RotationYaw;
            var hitBoxComponent = GetHitBoxComponent(gameEntity.EntityKey);

            if (hitBoxComponent != null)
            {
                hitBoxComponent.HitBoxGameObject.transform.position = position;
                hitBoxComponent.HitBoxGameObject.transform.rotation = rotation;

                var playerEntity = GetPlayerEntity(gameEntity);

                playerEntity.thirdPersonAnimator.UnityAnimator.cullingMode = AnimatorCullingMode.AlwaysAnimate;
                var provider = SingletonManager.Get <HitBoxTransformProviderCache>().GetProvider(playerEntity.thirdPersonModel.Value);
                provider.Update(position, rotation);
                HitBoxGameObjectUpdater.Update(hitBoxComponent.HitBoxGameObject.transform, provider);
                playerEntity.thirdPersonAnimator.UnityAnimator.cullingMode = AnimatorCullingMode.CullUpdateTransforms;

                if (_logger.IsDebugEnabled)
                {
                    _logger.DebugFormat("client animator {0}", playerEntity.networkAnimator.ToStringExt());
                    StringBuilder s = new StringBuilder();
                    hitBoxComponent.HitBoxGameObject.transform.Recursively(t => s.Append("[n " + t.name + ", p " + t.position.ToStringExt() + ", r " + t.rotation.ToStringExt() + "]"));
                    _logger.DebugFormat("hitbox pos {0}, rot {1}, transforms {2}, ", position, rotation, s);
                }
            }
        }
Esempio n. 2
0
        public void DrawHitBox(IGameEntity gameEntity, float time)
        {
            var hitBoxComponent = GetHitBoxComponent(gameEntity);

            if (hitBoxComponent != null)
            {
                var position = gameEntity.Position.Value;
                DebugDraw.DebugWireSphere(GetPosition(gameEntity),
                                          GetRadius(gameEntity), time);
                HitBoxGameObjectUpdater.DrawBoundBox(hitBoxComponent.HitBoxGameObject.transform, time);
            }
        }
        public void DrawHitBox(IGameEntity gameEntity, float time)
        {
            var subManager = GetSubManager(gameEntity.EntityType);

            if (subManager != null)
            {
                DebugDraw.DebugWireSphere(GetPosition(gameEntity), GetRadius(gameEntity), time);
                foreach (var item in subManager.GetCollidersTransform(gameEntity.EntityKey))
                {
                    HitBoxGameObjectUpdater.DrawBoundBox(item, time);
                }
            }
        }