public void ReplaceOrientation(OriginalOrientation newValue) { var index = GameComponentsLookup.Orientation; var component = CreateComponent <OrientationComponent>(index); component.Value = newValue; ReplaceComponent(index, component); }
protected override void Execute(List <GameEntity> entities) { foreach (GameEntity movingEntity in entities) { OriginalOrientation orientation = movingEntity.distanceMoved.Value.x >= 0 ? OriginalOrientation.Right : OriginalOrientation.Left; movingEntity.ReplaceOrientation(orientation); } }
protected override void Execute(List <GameEntity> entities) { foreach (GameEntity damageEntity in entities) { GameEntity attacker = damageEntity.damage.Origin; GameEntity defender = damageEntity.damage.Target; Vector2 distance = defender.position.Value - attacker.position.Value; OriginalOrientation orientation = distance.x >= 0 ? OriginalOrientation.Right : OriginalOrientation.Left; attacker.ReplaceOrientation(orientation); } }
private void SetUpOrientationSettings(GameEntity orientedEntity, OriginalOrientation originalOrientation) { Vector3 orientationRight; Vector3 orientationLeft; if (originalOrientation == OriginalOrientation.Right) { orientationRight = ORIENTATION_DEFAULT; orientationLeft = ORIENTATION_OPPOSITE; } else { orientationRight = ORIENTATION_OPPOSITE; orientationLeft = ORIENTATION_DEFAULT; } orientedEntity.ReplaceOrientationSettings( orientationRight, orientationLeft ); }