protected override bool PrivateAllow(SimDescription me) { if (!base.PrivateAllow(me)) { return(false); } if (me.LotHome == null) { return(false); } Sim sim = me.CreatedSim; if (sim == null) { return(false); } Autonomy autonomy = sim.Autonomy; if (autonomy == null) { return(false); } return(true); }
// GET: Autonomy public ActionResult Index() { var org = GetMyOrganisation(); var aut = org.Autonomy; // Fehelende Selbstverwaltung automatisch ergänzen if (aut == null) { aut = new Autonomy(); aut.Committees = new List <Committee>(); Db.Autonomy.Add(aut); org.Autonomy = aut; Db.SaveChanges(); } var model = new OrgAutonomyModel { Organiser = org, Autonomy = aut }; ViewBag.UserRight = GetUserRight(org); return(View(model)); }
public static void SetMetaAutonomyType(Lot lot, Lot.MetaAutonomyType type) { if (lot == null) { return; } lot.mMetaAutonomyType = type; Autonomy.AddPublicMetaObject(lot); MetaAutonomyTuning tuning = MetaAutonomyManager.GetTuning(lot.GetMetaAutonomyVenueType()); if (tuning != null) { foreach (Sim sim in LotManager.Actors) { if (sim.HasReasonToGoToVenue(tuning)) { MetaAutonomyManager.AddSimToVenue(sim, lot); } else { MetaAutonomyManager.RemoveSimFromVenue(sim, lot); } } } }
protected override bool Run(SimDescription me, bool singleSelection) { Sim sim = me.CreatedSim; if (sim == null) { return(false); } Autonomy autonomy = sim.Autonomy; if (autonomy == null) { return(false); } if (!ApplyAll) { string msg = "AdjustAutonomy:Prompt"; if (autonomy.mAutonomyDisabledCount > 0) { msg = "AdjustAutonomy:UnPrompt"; mAutonomous = 0; } else { mAutonomous = int.MaxValue / 2; } if (!AcceptCancelDialog.Show(Common.Localize(msg, me.IsFemale, new object[] { me }))) { return(false); } } autonomy.mAutonomyDisabledCount = mAutonomous; return(true); }
private bool ValidAttackGround(bool left) { var detectBoxGround = left ? mono.detectBoxGroundLeft : mono.detectBoxGroundRight; return(Autonomy.DetectOnGround(detectBoxGround, mono.blockLayer)); }