/// <summary>
    /// Launch individual drones from location of next available drone (going down the list)
    /// </summary>
    public void launchNextDrone(Transform target, int droneNum)
    {
        // If the level is over, do nothing
        if (levelControl.levelEnd)
        {
            return;
        }

        // Store reference to drone dock positions array
        Transform droneSpawnPosition = droneArray [droneNum];

        // Create a new gameobject that will be the drone that travels to the target cell
        GameObject droneTravellingGO = (GameObject)Instantiate(Resources.Load("DroneTravelling"));

        // Store a reference to the new travelling drone's transform
        Transform newDroneTravelling = droneTravellingGO.transform;

        // Store a reference to the droneControl script
        DroneControl newDroneTravellingControl = newDroneTravelling.GetComponent <DroneControl> ();

        // Move drone to spawn position
        newDroneTravelling.transform.position = droneSpawnPosition.position;

        // Set start position and dest cell in DroneControl script
        newDroneTravellingControl.startPosition = newDroneTravelling.transform.position;

        // Tell the new travelling drone what its target cell is
        newDroneTravellingControl.targetCell = target;

        // Set drone faction to that of this cell
        newDroneTravellingControl.faction = faction;

        // Set drone faction color
        newDroneTravellingControl.changeFactionColor(thisRenderer.material);
    }
示例#2
0
    void Start()
    {
        Transform       control     = GameObject.Find("PlayerRobot").transform;
        MultiContolBase playerRobot = new MultiContolBase(player.transform, control.Find("Pos"));

        player.SetTargetControl(control, playerRobot);
        playerRobot.Init();
        playerRobot.SetCameraHands(player.HUDCamera, player.rightHand, player.leftHand);
        multiControlsDic.Add(control.name, playerRobot);

        control = GameObject.Find("SpiralElevator").transform;
        SpiralElevatorControl spiralElevatorControl = new SpiralElevatorControl(control, control.Find("Pos"));

        spiralElevatorControl.Init();
        spiralElevatorControl.SetCameraHands(player.HUDCamera, player.leftHand, player.rightHand);
        multiControlsDic.Add(control.name, spiralElevatorControl);

        control = GameObject.Find("RoboArm").transform;
        RoboArmControl roboArmControl = new RoboArmControl(control, control.Find("Pos"));

        roboArmControl.Init();
        roboArmControl.SetCameraHands(player.HUDCamera, player.leftHand, player.rightHand);
        roboArmControl.GiveInputAction(player.SqueezeAction);
        multiControlsDic.Add(control.name, roboArmControl);

        control = GameObject.Find("Drone").transform;
        DroneControl droneControl = new DroneControl(control, control.Find("Pos"));

        droneControl.Init();
        droneControl.SetCameraHands(player.HUDCamera, player.leftHand, player.rightHand);
        droneControl.GiveInputAction(player.SqueezeAction);
        multiControlsDic.Add(control.name, droneControl);
    }
示例#3
0
        public SplashScreen(DroneControl droneControl)
        {
            InitializeComponent();

            this.droneControl    = droneControl;
            connectionSuccessful = false;
        }
示例#4
0
 public GPSDataRetriever(DroneControl droneCtrl)
 {
     count = 0;
     drone = new TelnetConnection(droneCtrl.droneConfig.DroneIpAddress, 23);
     Disconnect();
     System.Threading.Thread.Sleep(1000);
     Connect();
 }
        public NavDataRecorder(DroneControl droneControl, InputManager inputManager, double interval = 50)
        {
            xNavData              = new XElement("NavData");
            dataPoints            = 0;
            navDataTimer          = new Timer(interval);
            navDataTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);

            this.droneControl = droneControl;
            this.inputManager = inputManager;
        }
示例#6
0
        private void InitializeDroneControl()
        {
            DroneConfig droneConfig = new DroneConfig();

            droneConfig.FirmwareVersion   = SupportedFirmwareVersion.Firmware_164_Or_Above;
            droneConfig.DefaultCameraMode = DroneCameraMode.BottomCamera;

            droneControl        = new DroneControl(droneConfig);
            droneControl.Error += droneControl_Error_Async;
            droneControl.ConnectionStateChanged += droneControl_ConnectionStateChanged_Async;
        }
        private void InitializeDroneControl()
        {
            DroneConfig droneConfig = new DroneConfig();

            droneConfig.DefaultCameraMode = DroneCameraMode.BottomCamera;

            droneControl = new DroneControl();
            droneControl.Init(droneConfig);
            droneControl.Error += droneControl_Error_Async;
            droneControl.ConnectionStateChanged += droneControl_ConnectionStateChanged_Async;
        }
    void SelectCharacter()
    {
        if (GlobalControlsEnabled == false)
        {
            return;
        }
        if (selected == oldSelected) // if we are selecting the same character
        {
            //Debug.Log("1 " + selected);
            characterList[selected].selected = true;
            return;
        }

        int index = 0;

        foreach (PlayerMovement character in characterList)
        {
            if (character != null)
            {
                if (selected == index)
                {
                    if (characterEnabledList[index] != true) //this clause is for when a character is disabled, to try the next available one
                    {
                        if (characters > selected + 1)
                        {
                            selected++;
                        }
                        else
                        {
                            selected = 0;
                        }
                        SelectCharacter();//retry select
                        return;
                    }
                    character.selected = true;
                    active_character   = character;
                    d_camera[index].MoveToTopOfPrioritySubqueue();
                    listener.parent        = d_camera[index].Follow;
                    listener.localPosition = Vector3.zero;
                    oldSelected            = selected;

                    DroneControl ctl = active_character.GetComponent <DroneControl>();
                    DisplaySelected(active_character.name);
                }
                else
                {
                    character.selected = false;
                }
            }
            index++;
        }
    }
示例#9
0
        private void Initialize()
        {
            m_DroneControl        = new DroneControl();
            m_BadSignalController = new BadSignalController(
                m_DroneReferences.ReceiverCollider,
                m_BadSignalZoneLayerMask);
            m_DronePhysics = new SimpleDronePhysicsWithEngineModifiers(
                m_DronePhysicsSettings,
                transform,
                GetComponent <Rigidbody2D>());
            m_DroneBladesDamageController = new DroneBladesDamageController(
                m_DroneReferences.RightBladesCollider,
                m_DroneReferences.LeftBladesCollider,
                m_ObstacleLayerMask,
                m_DroneReferences.RightBladesObject,
                m_DroneReferences.LeftBladesObject,
                m_DronePhysics);

            m_DronePhysics.SetEngineModifiers(m_BadSignalController, m_DroneBladesDamageController);
            m_DronePhysics.SubscribeOnControl(m_DroneControl);
        }
示例#10
0
 public void AddDrone()
 {
     if (UpgradeCount() < maxDrones && (dronePrefab))
     {
         GameObject newDrone = GameObject.Instantiate(dronePrefab) as GameObject;
         newDrone.transform.parent = ShipContainer.lastContainer.transform;
         DroneControl drone = newDrone.GetComponent <DroneControl> ();
         drone.container = this;
         if (UpgradeCount() == 0)
         {
             drones [0] = newDrone;
         }
         else
         {
             drones [Find(null)] = newDrone;
         }
         RepositionDrones();
         SpawnAll();
         drone.Spawn(brachia [Find(newDrone)]);
     }
     lastCount = UpgradeCount();
 }
示例#11
0
    public void ChangeToNext(GameObject cameraBase, bool fade = true)
    {
        int          index = Random.Range(0, drones.Length);
        DroneControl drone = RayCastBase.GetCurrent() as DroneControl;

        if (drone)
        {
            index = drones.ToList().IndexOf(drone);
        }

        if (index >= 0 && drones.Length > 0)
        {
            if (fade)
            {
                drones[index].Action(cameraBase);
            }
            else
            {
                drones[index].ActionWithoutFade(cameraBase);
            }
        }
    }
示例#12
0
        public void MakeRandomlyPositionedDrone()
        {
            ContentRef <Prefab> droneRef = ContentProvider.RequestContent <Prefab>(@"Data\drone.Prefab.res");
            Prefab dronePrefab           = droneRef.Res;

            float startX = (random.Next(0, 51) <= 50) ? WORLD_WIDTH : -WORLD_WIDTH;
            float endX   = -startX;

            Vector3 startingPosition = new Vector3(startX, random.Next(-2000, -1000), 0);
            Vector3 targetPosition   = new Vector3(endX, random.Next(-2000, -1000), 0);

            GameObject   drone        = dronePrefab.Instantiate(startingPosition);
            DroneControl droneControl = drone.GetComponent <DroneControl>();

            droneControl.TargetPosition = targetPosition;

            var body = drone.GetComponent <RigidBody>();

            //if (startX < 0)
            //    body.LinearVelocity = new Vector2(200, 0);
            //else
            //    body.LinearVelocity = new Vector2(-200 , 0);

            droneControl.SetFixedAngle(true);

            // Add package
            {
                ContentRef <Prefab> packageRef = ContentProvider.RequestContent <Prefab>(@"Data\package.Prefab.res");
                Prefab         packagePrefab   = packageRef.Res;
                GameObject     package         = packagePrefab.Instantiate();
                PackageControl packageControl  = package.GetComponent <PackageControl>();
                packageControl.AttachToDrone(droneControl);
                droneControl.AttachPackage(packageControl);

                Scene.Current.AddObject(package);
            }

            Scene.Current.AddObject(drone);
        }
示例#13
0
 private void InitializeDroneControl(DroneConfig droneConfig)
 {
     droneControl = new DroneControl(droneConfig);
 }
 public InstrumentsManager(DroneControl arDroneControl)
 {
     this.droneControl = arDroneControl;
     instrumentList    = new List <InstrumentControl>();
 }
示例#15
0
 public void Start()
 {
     // Take the variable Mode contained in the Script 'DroneControl'
     mode = Drone.GetComponentInParent <DroneControl>();
 }
示例#16
0
 public void SubscribeOnControl(DroneControl control)
 {
     AddDisposable(control.RightIsPressed.Subscribe(value => RightEngineIsOn = value));
     AddDisposable(control.LeftIsPressed.Subscribe(value => LeftEngineIsOn   = value));
 }
示例#17
0
        public Detection(DroneControl droneControl)
        {
            this.droneControl = droneControl;

            Task.Factory.StartNew(() => initializeThread());
        }
示例#18
0
 public void Start()
 {
     // Take the variable Power contained in the Script 'DroneControl'
     power = Drone.GetComponentInParent <DroneControl>();
 }
示例#19
0
 private void SetMyDrone(DroneControl myDrone)
 {
     myDrone = this.myDrone;
 }