public NetworkedDrone(float speed, float size, DroneColor color, DroneType droneType, DroneState state)
     : base(speed, size, color, droneType, null)
 {
     _position    = new Vector3(state.PosX, 0.4f, state.PosZ);
     _state       = state;
     MovementType = null;
 }
Exemple #2
0
 public RedDrone(float speed, float size, DroneColor color, float acceleration, Area area, float waitTime = 0.5f, bool synchronized = false,
                 DroneType droneType = DroneType.FlyingOneWayDrone) :
     base(speed, size, color, droneType, null)
 {
     _area        = area;
     MovementType = new PointToPointMovement(area, Size, acceleration, waitTime, synchronized);
 }
Exemple #3
0
 public RandomDrone(float speed, float size, DroneColor color, DroneType droneType = DroneType.BouncingDrone, float restrictedZone = 1, float coneRange = 360, float startDirection = 0,
                    IDroneMovement movementType = null) : base(speed, size, color, droneType, movementType)
 {
     _restrictedZone = restrictedZone;
     _coneRange      = coneRange;
     _startDirection = startDirection;
 }
Exemple #4
0
    public static string GetUniqueCharacteristic(DroneType type)
    {
        switch (type)
        {
        case DroneType.Mini:
            return("FREE CANNON.\n");

        case DroneType.Worker:
            return("COLLECTS DIFFERENT OBJECTS.\n");

        case DroneType.Strike:
            return("60% WEAPON ENERGY USAGE.\n");

        case DroneType.Light:
            return("60% LIGHTER THAN USUAL.\n");

        case DroneType.Gun:
            return("WEAPONS COOLDOWN 66% FASTER.\n");

        case DroneType.Counter:
            return("75% MORE WEAPON DAMAGE AGAINST DRONES.");

        case DroneType.Torpedo:
            return("WEAPONS ATTACK ONLY GROUND ENTITIES.");

        case DroneType.Heavy:
            return("REGENERATES 20 CORE PER SECOND.\n");

        default:
            return("");
        }
    }
Exemple #5
0
    public static string GetAbilityNameByType(DroneType type)
    {
        switch (type)
        {
        case DroneType.Mini:
            return("Mini Drone");

        case DroneType.Worker:
            return("Worker Drone");

        case DroneType.Strike:
            return("Strike Drone");

        case DroneType.Counter:
            return("Counter Drone");

        case DroneType.Gun:
            return("Gun Drone");

        case DroneType.Torpedo:
            return("Torpedo Drone");

        case DroneType.Light:
            return("Light Drone");

        case DroneType.Heavy:
            return("Heavy Drone");

        default:
            return("Spawn Drone");
        }
    }
Exemple #6
0
    public static string GetDescriptionByType(DroneType type)
    {
        switch (type)
        {
        case DroneType.Mini:
            return("Spawns a Mini Drone, which have free cannons.");

        case DroneType.Worker:
            return("Spawns a Worker Drone, which can collect various objects for you.");

        case DroneType.Strike:
            return("Spawns a Strike Drone, their weapons use less energy.");

        case DroneType.Counter:
            return("Spawns a Counter Drone, they deal much more damage against other drones.");

        case DroneType.Gun:
            return("Spawns a Gun Drone, their weapons cooldown faster.");

        case DroneType.Torpedo:
            return("Spawns a Torpedo Drone, all of their weapons attack only ground entities.");

        case DroneType.Light:
            return("Spawns a Light Drone, they are lighter than usual.");

        case DroneType.Heavy:
            return("Spawns a Heavy Drone, they regenerate their core.");

        default:
            return("Spawns a drone.");
        }
    }
Exemple #7
0
 /// <summary>
 /// Creates a new drone.
 /// </summary>
 public Drone(vec3 target, Player owner, DroneType type)
 {
     TargetPosition  = target;
     Owner           = owner;
     CurrentPosition = Owner.Position;
     Type            = type;
 }
Exemple #8
0
 public void Deserialize(DeserializeEvent e)
 {
     State     = e.Reader.ReadSerializable <DroneState>();
     Speed     = e.Reader.ReadSingle();
     Size      = e.Reader.ReadSingle();
     Color     = (DroneColor)e.Reader.ReadByte();
     DroneType = (DroneType)e.Reader.ReadByte();
 }
Exemple #9
0
 public SpawnDroneData(DroneState state, float speed, float size, DroneColor color, DroneType droneType)
 {
     State     = state;
     Speed     = speed;
     Size      = size;
     Color     = color;
     DroneType = droneType;
 }
Exemple #10
0
    public static DroneSpawnData GetDefaultData(DroneType type)
    {
        DroneSpawnData data;

        // pretty much the same thing repeated multiple times so that if one part ever becomes different it doesn't break
        switch (type)
        {
        case DroneType.Mini:
            data       = ResourceManager.GetAsset <DroneSpawnData>("mini_drone_spawn");
            data.drone = JsonUtility.ToJson(ResourceManager.GetAsset <EntityBlueprint>("mini_drone_blueprint"));
            break;

        case DroneType.Counter:
            data       = ResourceManager.GetAsset <DroneSpawnData>("counter_drone_spawn");
            data.drone = JsonUtility.ToJson(ResourceManager.GetAsset <EntityBlueprint>("counter_drone_blueprint"));
            break;

        case DroneType.Light:
            data       = ResourceManager.GetAsset <DroneSpawnData>("light_drone_spawn");
            data.drone = JsonUtility.ToJson(ResourceManager.GetAsset <EntityBlueprint>("light_drone_blueprint"));
            break;

        case DroneType.Strike:
            data       = ResourceManager.GetAsset <DroneSpawnData>("strike_drone_spawn");
            data.drone = JsonUtility.ToJson(ResourceManager.GetAsset <EntityBlueprint>("strike_drone_blueprint"));
            break;

        case DroneType.Worker:
            data       = ResourceManager.GetAsset <DroneSpawnData>("worker_drone_spawn");
            data.drone = JsonUtility.ToJson(ResourceManager.GetAsset <EntityBlueprint>("worker_drone_blueprint"));
            break;

        case DroneType.Gun:
            data       = ResourceManager.GetAsset <DroneSpawnData>("gun_drone_spawn");
            data.drone = JsonUtility.ToJson(ResourceManager.GetAsset <EntityBlueprint>("gun_drone_blueprint"));
            break;

        case DroneType.Torpedo:
            data       = ResourceManager.GetAsset <DroneSpawnData>("torpedo_drone_spawn");
            data.drone = JsonUtility.ToJson(ResourceManager.GetAsset <EntityBlueprint>("torpedo_drone_blueprint"));
            break;

        case DroneType.Heavy:
            data       = ResourceManager.GetAsset <DroneSpawnData>("heavy_drone_spawn");
            data.drone = JsonUtility.ToJson(ResourceManager.GetAsset <EntityBlueprint>("heavy_drone_blueprint"));
            break;

        default:
            return(null);
        }

        data.cooldown   = GetCooldown(type);
        data.energyCost = GetEnergyCost(type);
        return(data);
    }
Exemple #11
0
 protected override void Start()
 {
     if (blueprint.useCustomDroneType)
     {
         type = blueprint.customDroneType;
     }
     if (!initialized)
     {
         Init();
     }
 }
Exemple #12
0
 public Drone(int id, int accountId, DroneType droneType, Level level, int experience, int damage, int design1, int design2)
 {
     Id         = id;
     AccountId  = accountId;
     DroneType  = droneType;
     Level      = level;
     Experience = experience;
     Damage     = damage;
     Design1    = design1;
     Design2    = design2;
 }
Exemple #13
0
 protected ADrone(float speed, float size, DroneColor color, DroneType droneType, IDroneMovement movementType,
                  IPattern pattern = null, IDrone spawnedDrones = null)
 {
     Speed         = speed;
     Size          = size;
     Color         = color;
     DroneType     = droneType;
     MovementType  = movementType ?? new StraightMovement();
     Pattern       = pattern;
     SpawnedDrones = spawnedDrones;
 }
Exemple #14
0
 public Drone(int id, Player player, DroneType droneType, Level level, int experience, int damage,
              int upgradeLevel)
 {
     Id           = id;
     Player       = player;
     DroneType    = droneType;
     Level        = level;
     Experience   = experience;
     Damage       = damage;
     UpgradeLevel = upgradeLevel;
 }
 // Drone constructor
 public Drone(string droneId, DroneType droneType, int maxSpeed, double airborneAltitudeSet)
 {
     this.Droneid = droneId;
     this.Type = droneType;
     this.maxSpeedLimit = maxSpeed;
     this.airborneAltitude = airborneAltitudeSet;
     this.flightTimer = new Timer(1000);
     flightTimer.Stop();
     // add event handler for timer tick of flight control
     flightTimer.Elapsed += FlightTimer_Elapsed;
 }
Exemple #16
0
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            NetworkInformation.NetworkStatusChanged += NetworkStatusChanged;

            isRPi          = true;
            internetAccess = IsInternetAvailable();
            HostName       = "192.168.4.1"; // 192.168.4.1 for wemos - 192.168.137.1 for minwinpc
            Mode           = Mode.Cellular;
            DroneName      = "drone";
            DroneType      = DroneType.Custom;
        }
Exemple #17
0
    private void setCannonAndDrone(Scene scene, LoadSceneMode mode)
    {
        SecondaryCannonType chosenCannon = SecondaryCannonType.Angle0;
        DroneType           chosenDrone  = DroneType.Magnetic;

        if (scene.name == "Test")
        {
            switch (cannon)
            {
            case 0:
                chosenCannon = SecondaryCannonType.Angle0;
                break;

            case 1:
                chosenCannon = SecondaryCannonType.Angle30;
                break;

            case 2:
                chosenCannon = SecondaryCannonType.Angle75;
                break;

            case 3:
                chosenCannon = SecondaryCannonType.Angle120;
                break;
            }
            switch (drone)
            {
            case 0:
                chosenDrone = DroneType.Attack;
                break;

            case 1:
                chosenDrone = DroneType.Magnetic;
                break;

            case 2:
                chosenDrone = DroneType.Healer;
                break;

            case 3:
                chosenDrone = DroneType.Rocket;
                break;
            }
            FindObjectOfType <ShipController>().myDroneType           = chosenDrone;
            FindObjectOfType <ShipController>().mySecondaryCannonType = chosenCannon;
        }
    }
 public void SetCurrentDrone(DroneType currentType)
 {
     for (int i = 0; i < allDrones.Count; i++)
     {
         if (allDrones[i].thisDroneType == myDroneType)
         {
             allDrones[i].gameObject.SetActive(true);
             Meshs.Add(allDrones[i].gameObject);
         }
         else
         {
             allDrones[i].gameObject.SetActive(false);
             if (Meshs.Contains(allDrones[i].gameObject))
             {
                 Meshs.Remove(allDrones[i].gameObject);
             }
         }
     }
 }
Exemple #19
0
    public static int GetDelay(DroneType type)
    {
        switch (type)
        {
        case DroneType.Mini:
        case DroneType.Worker:
            return(2);

        case DroneType.Strike:
        case DroneType.Light:
        case DroneType.Counter:
        case DroneType.Gun:
            return(3);

        case DroneType.Torpedo:
            return(5);

        case DroneType.Heavy:
            return(8);

        default:
            return(0);
        }
    }
Exemple #20
0
    public static int GetCooldown(DroneType type)
    {
        switch (type)
        {
        case DroneType.Mini:
        case DroneType.Worker:
            return(10);

        case DroneType.Strike:
        case DroneType.Light:
        case DroneType.Counter:
        case DroneType.Gun:
            return(15);

        case DroneType.Torpedo:
            return(20);

        case DroneType.Heavy:
            return(30);

        default:
            return(0);
        }
    }
Exemple #21
0
    public static int GetEnergyCost(DroneType type)
    {
        switch (type)
        {
        case DroneType.Mini:
        case DroneType.Worker:
            return(100);

        case DroneType.Strike:
        case DroneType.Light:
        case DroneType.Counter:
        case DroneType.Gun:
            return(150);

        case DroneType.Torpedo:
            return(200);

        case DroneType.Heavy:
            return(400);

        default:
            return(0);
        }
    }
Exemple #22
0
 public MineDrone(float speed, float size, DroneColor color, IPattern pattern = null, IDrone spawnedDrones = null, DroneType droneType = DroneType.FlyingBouncingMine,
                  IDroneMovement movementType = null) : base(speed, size, color, droneType, movementType, pattern, spawnedDrones)
 {
 }
 public void SetDroneType(DroneType type)
 {
     this.type = type;
     droneCard.UpdateStaticText();
 }
Exemple #24
0
    /// <summary>
    /// Create a Drone gameobject and attach DroneFlightSim, required ROSDroneConnnection and initialize the ROS connection.
    /// </summary>
    /// <param name="rosDroneConnectionInput"></param>
    private void InstantiateDrone(ROSDroneConnectionInput rosDroneConnectionInput)
    {
        // All the variables required to create the drone
        DroneType     droneType        = rosDroneConnectionInput.droneType;
        string        droneIP          = rosDroneConnectionInput.url;
        int           dronePort        = rosDroneConnectionInput.port;
        bool          simFlight        = rosDroneConnectionInput.simFlight;
        List <string> droneSubscribers = new List <string>();

        foreach (DroneSubscribers subscriber in rosDroneConnectionInput.droneSubscribers)
        {
            droneSubscribers.Add(subscriber.ToString());
        }

        // Create a new drone
        Drone droneInstance = new Drone(WorldProperties.worldObject.transform.position, uniqueID);

        Debug.Log("Drone that was just made " + droneInstance.gameObjectPointer.name);
        DroneProperties droneProperties = droneInstance.droneProperties;
        GameObject      droneGameObject = droneInstance.gameObjectPointer;

        droneGameObject.name = rosDroneConnectionInput.droneName;

        ROSDroneConnectionInterface rosDroneConnection = null;

        // Add corresponding ros drone connection script
        switch (droneType)
        {
        case DroneType.M100:
            Debug.Log("M100 created");
            M100_ROSDroneConnection M100_rosDroneConnection = droneGameObject.AddComponent <M100_ROSDroneConnection>();
            M100_rosDroneConnection.InitilizeDrone(uniqueID, droneIP, dronePort, droneSubscribers, simFlight, droneProperties);
            rosDroneConnection = M100_rosDroneConnection;
            droneGameObject.GetComponent <DroneProperties>().droneROSConnection = M100_rosDroneConnection;
            ROSDroneConnections.Add(uniqueID, M100_rosDroneConnection);
            break;

        case DroneType.M210:
            Debug.Log("M210 created");
            M210_ROSDroneConnection M210_rosDroneConnection = droneGameObject.AddComponent <M210_ROSDroneConnection>();
            M210_rosDroneConnection.InitilizeDrone(uniqueID, droneIP, dronePort, droneSubscribers, simFlight, droneProperties);
            rosDroneConnection = M210_rosDroneConnection;
            droneGameObject.GetComponent <DroneProperties>().droneROSConnection = M210_rosDroneConnection;
            ROSDroneConnections.Add(uniqueID, M210_rosDroneConnection);
            break;

        case DroneType.M600:
            Debug.Log("M600 created");
            M600_ROSDroneConnection M600_rosDroneConnection = droneGameObject.AddComponent <M600_ROSDroneConnection>();
            M600_rosDroneConnection.InitilizeDrone(uniqueID, droneIP, dronePort, droneSubscribers, simFlight, droneProperties);
            rosDroneConnection = M600_rosDroneConnection;
            droneGameObject.GetComponent <DroneProperties>().droneROSConnection = M600_rosDroneConnection;
            ROSDroneConnections.Add(uniqueID, M600_rosDroneConnection);
            break;

        case DroneType.Sprite:
            Debug.Log("Sprite class not implemented created");
            //Sprite_ROSDroneConnection drone_rosDroneConnection = drone.AddComponent<Sprite_ROSDroneConnection>();
            break;

        default:
            Debug.Log("No drone type selected");
            return;
        }

        // Create attached sensors
        foreach (ROSSensorConnectionInput rosSensorInput in rosDroneConnectionInput.attachedSensors)
        {
            ROSSensorConnectionInterface sensor = InstantiateSensor(rosSensorInput);
            droneInstance.AddSensor(sensor);
        }

        // Initilize drone sim manager script on the drone
        DroneSimulationManager droneSim = droneGameObject.GetComponent <DroneSimulationManager>();

        droneSim.InitDroneSim();
        droneProperties.droneSimulationManager = droneSim;

        // Get DroneMenu and instansiate.
        DroneMenu droneMenu = droneGameObject.GetComponent <DroneMenu>();

        droneMenu.InitDroneMenu(rosDroneConnection, droneSubscribers);
        droneGameObject.GetComponent <DroneProperties>().droneMenu = droneMenu;

        uniqueID++;
    }
Exemple #25
0
 public DefaultDrone(float speed, float size, DroneColor color, Vector3?position = null, float direction = 0, DroneType droneType = DroneType.FlyingOneWayDrone,
                     IDroneMovement movementType = null) : base(speed, size, color, droneType, movementType)
 {
     _position  = position ?? new Vector3(0, 0.4f, 0);
     _direction = direction;
 }
 private void Awake()
 {
     mySecondaryCannonType = (SecondaryCannonType)(PlayerPrefs.HasKey("selectedSecondaryCannonIndex") == true ? PlayerPrefs.GetInt("selectedSecondaryCannonIndex") : 0);
     myDroneType           = (DroneType)(PlayerPrefs.HasKey("selectedDroneIndex") == true ? PlayerPrefs.GetInt("selectedDroneIndex") : 0);
 }