private List <WheelMenuItem> PrepareDataSource(Client sender, object target, params object[] args) { List <WheelMenuItem> menuItems = new List <WheelMenuItem>(); if (target is Client) { } else if (target is VehicleEntity vehicle) { CharacterEntity senderCharacter = sender.GetAccountEntity().CharacterEntity; if (VehicleScript.GetVehicleDoorCount((VehicleHash)vehicle.GameVehicle.Model) >= 4) { menuItems.Add(new WheelMenuItem("hood", senderCharacter, target, (s, e) => VehicleScript.ChangeDoorState(s, ((VehicleEntity)e).GameVehicle.Handle, (int)Doors.Hood))); menuItems.Add(new WheelMenuItem("trunk", senderCharacter, target, (s, e) => VehicleScript.ChangeDoorState(s, ((VehicleEntity)e).GameVehicle.Handle, (int)Doors.Trunk))); } if (vehicle.DbModel.Character == sender.GetAccountEntity().CharacterEntity.DbModel) { menuItems.Add(new WheelMenuItem("lock", senderCharacter, null, (s, e) => VehicleScript.ChangePlayerVehicleLockState(s))); } menuItems.Add(new WheelMenuItem("numberplate", senderCharacter, target, (s, e) => VehicleScript.ShowVehiclesInformation(s, ((VehicleEntity)e).DbModel, true))); } return(menuItems); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "v1"); }); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseAuthentication(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); using var scope = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope(); using var context = scope.ServiceProvider.GetRequiredService <ApplicationDbContext>(); if (context.Database.EnsureCreated()) { var roles = RoleScript.Roles(); var admin = AdministratorScript.ApplicationUser(); var adminUser = UserRoleScript.UserRole(roles.FirstOrDefault(x => x.NormalizedName.Equals("ADMINISTRATOR")), admin); var types = TypeScript.GetTypes(); var company = CompanyScript.GetCompany(); var user = UserScript.ApplicationUser(); var userRole = UserRoleScript.UserRole(roles.FirstOrDefault(x => x.NormalizedName.Equals("USER")), user); var vehiclesList = VehicleScript.GetVehicles(); context.Roles.AddRangeAsync(roles).Wait(); context.ApplicationUser.Add(admin); context.UserRoles.Add(adminUser); context.Type.AddRangeAsync(types).Wait(); context.Company.Add(company); context.ApplicationUser.Add(user); context.UserRoles.Add(userRole); context.UserCompany.Add(new UserCompany { CompanyID = company.ID, UserID = user.Id }); context.SaveChangesAsync().Wait(); } }
private void Awake() { S = this; }
public override void ApplyEffect(VehicleScript entity) { entity.AddEffect(this); }
// implementation of damage effect public override void ApplyEffect(VehicleScript entity) { entity.GetComponent <HealthScript>().TakeDamage(damage); }
protected Vector3 Evade(VehicleScript targetVehicle) { return(Flee(targetVehicle.transform.position + (evadeMag * targetVehicle.Velocity))); }
protected Vector3 Pursue(VehicleScript targetVehicle) { return(Seek(targetVehicle.transform.position + (pursuitMag * targetVehicle.Velocity))); }
void IPunInstantiateMagicCallback.OnPhotonInstantiate(PhotonMessageInfo info) { Debug.Log("Spawn start"); GetComponent <VehicleHealthManager>().SetupVehicleManager(); gamestateTracker = FindObjectOfType <GamestateTracker>(); teamId = (int)info.photonView.InstantiationData[0]; gameObject.name = gameObject.name + teamId; MonoBehaviour[] scripts = GetComponentsInChildren <MonoBehaviour>(true); List <MonoBehaviour> playerDriverScriptsList = new List <MonoBehaviour>(); List <MonoBehaviour> playerGunnerScriptsList = new List <MonoBehaviour>(); List <MonoBehaviour> aiDriverScriptsList = new List <MonoBehaviour>(); List <MonoBehaviour> aiGunnerScriptsList = new List <MonoBehaviour>(); foreach (MonoBehaviour script in scripts) { object[] vehicleScriptAttributes = script.GetType().GetCustomAttributes(typeof(VehicleScript), false); foreach (object attribute in vehicleScriptAttributes) { VehicleScript vehicleScript = attribute as VehicleScript; if (vehicleScript == null) { Debug.LogWarning("Non-VehicleScript script picked up"); } else { if (vehicleScript.scriptType == ScriptType.playerDriverScript) { playerDriverScriptsList.Add(script); } if (vehicleScript.scriptType == ScriptType.playerGunnerScript) { playerGunnerScriptsList.Add(script); } if (vehicleScript.scriptType == ScriptType.aiDriverScript) { aiDriverScriptsList.Add(script); } if (vehicleScript.scriptType == ScriptType.aiGunnerScript) { aiGunnerScriptsList.Add(script); } } } } playerDriverScripts = playerDriverScriptsList.ToArray(); playerGunnerScripts = playerGunnerScriptsList.ToArray(); aiDriverScripts = aiDriverScriptsList.ToArray(); aiGunnerScripts = aiGunnerScriptsList.ToArray(); //GamestateTracker.PlayerDetails driverDetails = gamestateTracker.GetPlayerWithDetails(role: "Driver", teamId: teamId); //GamestateTracker.PlayerDetails gunnerDetails = gamestateTracker.GetPlayerWithDetails(role: "Gunner", teamId: teamId); PlayerEntry driverEntry = gamestateTracker.players.Find((PlayerEntry entry) => { return(entry.role == (short)PlayerEntry.Role.Driver && entry.teamId == teamId); }); driverNickName = driverEntry.name; driverId = driverEntry.id; botDriver = driverEntry.isBot; PlayerEntry gunnerEntry = gamestateTracker.players.Find((PlayerEntry entry) => { return(entry.role == (short)PlayerEntry.Role.Gunner && entry.teamId == teamId); }); gunnerNickName = gunnerEntry.name; gunnerId = gunnerEntry.id; botGunner = gunnerEntry.isBot; GetComponentInChildren <PotatoEffects>().Setup(); // firstly, if the gunner is a human, transfer the photonview ownership to the player's client PhotonNetwork.AddCallbackTarget(GetComponentInChildren <GunnerWeaponManager>()); if (!botDriver) { TransferDriverPhotonViewOwnership(); } if (!botGunner) { TransferGunnerPhotonViewOwnership(); } // transfer control to master client if bot if (botDriver) { driverPhotonView.TransferOwnership(PhotonNetwork.MasterClient); } if (botGunner) { gunnerPhotonView.TransferOwnership(PhotonNetwork.MasterClient); } }
public abstract void ApplyEffect(VehicleScript entity);