private static bool CanUnlock( Comps.Projectile.Kind projectileKind, Comps.Door.Kind doorKind ) { switch (doorKind) { case Comps.Door.Kind.Red: return(projectileKind == Comps.Projectile.Kind.RedKey); case Comps.Door.Kind.Green: return(projectileKind == Comps.Projectile.Kind.GreenKey); case Comps.Door.Kind.Blue: return(projectileKind == Comps.Projectile.Kind.BlueKey); case Comps.Door.Kind.Purple: return(projectileKind == Comps.Projectile.Kind.PurpleKey); case Comps.Door.Kind.Yellow: return(projectileKind == Comps.Projectile.Kind.YellowKey); default: throw new ArgumentException("Invalid door kind"); } }
public static Entity Create( Comps.Door.Kind kind, PhysicalVector2 position, Ecs.Registry registry ) { var result = registry.CreateEntity(); registry.AssignComponent( result, new Comps.Door { kind = kind } ); registry.AssignComponent( result, new Comps.Solid { unmovable = true } ); registry.AssignComponent( result, new Comps.Position { data = position } ); registry.AssignComponent( result, new Comps.Shapes.Rectangle { data = new Physical.Rectangle(32.0f * 6, 32.0f * 2) } ); return(result); }