public override void Update(GameTime gameTime) { base.Update(gameTime); _modelEntityComponent = _modelEntityComponent ?? Parent.GetComponent <ModelEntityComponent>(); var movementDirection = Parent.LastTranslation; if (movementDirection.LengthSquared() > 0.0f) { if (movementDirection.X > 0.0f) { PlayAnimation(RightAnimation); } else if (movementDirection.X < 0.0f) { PlayAnimation(LeftAnimation); } else { PlayAnimation(movementDirection.Z > 0.0f ? ForwardAnimation : BackwardAnimation); } } else { StopAnimation(); if (_modelEntityComponent != null) { _modelEntityComponent.Material.TexcoordOffset = Vector2.Zero; } } }
public override void Update(GameTime gameTime) { base.Update(gameTime); _modelEntityComponent = _modelEntityComponent ?? Parent.GetComponent<ModelEntityComponent>(); var movementDirection = Parent.LastTranslation; if (movementDirection.LengthSquared() > 0.0f) { if (movementDirection.X > 0.0f) { PlayAnimation(RightAnimation); } else if (movementDirection.X < 0.0f) { PlayAnimation(LeftAnimation); } else { PlayAnimation(movementDirection.Z > 0.0f ? ForwardAnimation : BackwardAnimation); } } else { StopAnimation(); if (_modelEntityComponent != null) _modelEntityComponent.Material.TexcoordOffset = Vector2.Zero; } }
private void OnUpdateAnimationFrame(int textureIndex) { _modelComponent = _modelComponent ?? ReferringEntity.GetComponent<ModelEntityComponent>(); if (_modelComponent != null && textureIndex < _modelComponent.Regions.Count) { _modelComponent.SetTexture(textureIndex); } }
private void OnUpdateAnimationFrame(int textureIndex) { _modelComponent = _modelComponent ?? Parent.GetComponent <ModelEntityComponent>(); if (_modelComponent != null && textureIndex < _modelComponent.Regions.Count) { _modelComponent.SetTexture(textureIndex); } }
public override EntityComponent Clone(Entity target) { var clonedComponent = new ModelEntityComponent(target); clonedComponent._regions = _regions != null ? new List<TextureRegion>(_regions) : null; clonedComponent._drawableElement = GameInstance.GetService<SceneRenderer>().CreateDrawableElement(target.IsInitializing); clonedComponent._drawableElement.Material = Material; clonedComponent._drawableElement.Mesh = Mesh; clonedComponent.IsBillboard = IsBillboard; clonedComponent.IsActive = target.IsActive; return clonedComponent; }