public TwitchPilotBase GetTwitchPilot(string username) { TwitchPilotBase result = null; for (int i = 0; i < pilots.Count; i++) { if (pilots[i].username == username) { result = pilots[i]; } } return(result); }
public string Command(string username, TwitchPilotBase.PilotCommand command, List <string> args) { TwitchPilotBase pilot = GetTwitchPilot(username); if (pilot != null) { return(pilot.Command(command, args)); } else { return(username + ", you dont have a vehicle, type \"!register <actor_name>\" to get control of a vehicle"); } }
public string Release(string username) { TwitchPilotBase pilot = GetTwitchPilot(username); if (pilot != null) { int id = GetPilotId(username); pilot.Remove(); pilots.RemoveAt(id); return("Control released."); } else { return("You have no vehicle."); } }
public string Register(Actor actor, string username) { if (GetTwitchPilot(username) == null) { if (IsActorTaken(actor)) { return(username + ", that vehicle is already taken."); } else { if (actor.gameObject == VTOLAPI.GetPlayersVehicleGameObject()) { return("You aren't allowed to control the player."); } else { ActorType type = GetActorType(actor); string message = "you have control!"; TwitchPilotBase pilot = null; switch (type) { case ActorType.Plane: TwitchPilotAircraft temp = new TwitchPilotAircraft(); pilot = temp; break; case ActorType.Boat: TwitchPilotBoat temp2 = new TwitchPilotBoat(); pilot = temp2; pilot.nameTagHeight = 50; pilot.fontSize = 50; message = "you have boat!"; break; case ActorType.Carrier: TwitchPilotCarrier temp3 = new TwitchPilotCarrier(); pilot = temp3; pilot.nameTagHeight = 50; pilot.fontSize = 50; message = "you have boat!"; break; case ActorType.DroneCarrier: TwitchPilotDroneCarrier temp4 = new TwitchPilotDroneCarrier(); pilot = temp4; pilot.nameTagHeight = 50; pilot.fontSize = 50; message = "you have boat!"; break; case ActorType.Tank: TwitchPilotTank temp5 = new TwitchPilotTank(); pilot = temp5; message = "PANZER VOR!"; break; case ActorType.Artillery: TwitchPilotArty temp6 = new TwitchPilotArty(); pilot = temp6; break; default: TwitchPilotBase temp7 = new TwitchPilotBase(); pilot = temp7; break; } pilot.actor = actor; pilot.wm = pilot.actor.weaponManager; pilot.username = username; pilot.player = VTOLAPI.GetPlayersVehicleGameObject(); pilot.Start(); pilots.Add(pilot); return(username + ", " + message); } } } else { return(username + ", you already have control of a vehicle."); } }