public Entity SetUser(System.DateTime newTimestamp, bool newIsLoggedIn) { if(hasUser) { throw new EntitasException("Could not set user!\n" + this + " already has an entity with UserComponent!", "You should check if the context already has a userEntity before setting it or use context.ReplaceUser()."); } var entity = CreateEntity(); entity.AddUser(newTimestamp, newIsLoggedIn); return entity; }
#pragma warning disable static void userComponent(Context context, UserComponent component) { var e = context.userEntity; var name = context.user.name; var has = context.hasUser; context.SetUser("John", 42); context.ReplaceUser("Max", 24); context.RemoveUser(); }