Esempio n. 1
0
 public void SetMode(DroneMode newMode)
 {
     if (newMode == DroneMode.DISABLED)
     {
         Reset();
     }
     else if (mode == DroneMode.DISABLED && newMode != DroneMode.DISABLED)
     {
         transform.position    = camController.viewFinder.transform.position;
         transform.eulerAngles = new Vector3(0, camController.viewFinder.transform.eulerAngles.y, 0);
     }
     mode = newMode;
 }
Esempio n. 2
0
    public void Die()
    {
        Mode                    = DroneMode.Dead;
        Collision.IsDead        = true;
        Weapon.Collision.IsDead = true;

        if (Health.Current <= 0)
        {
            MakeExplosion();
        }
        Owner.PlayerController.PlayerUnitCount -= 1;
        PlayerController.UnitCount             -= 1;
        ObjectPool.Recycle(gameObject);
    }
Esempio n. 3
0
            void Start()
            {
                enemyTeamIndex = baseAI.master.teamIndex == TeamIndex.Player ? TeamIndex.Monster : TeamIndex.Player;

                if (!equipmentSlot)
                {
                    if (baseAI.body && baseAI.body.inventory)
                    {
                        equipmentSlot = baseAI.body.equipmentSlot;
                    }
                }
                equipmentIndex = baseAI.master.inventory.currentEquipmentIndex;

                droneMode = EvaluateDroneMode(equipmentIndex);
                _logger.LogMessage($"Chosen Drone Mode: {droneMode}");
            }
Esempio n. 4
0
 public void SetPatrolMode()
 {
     if (!nextWaypoint)
     {
         Debug.LogError("Error:  nextWaypoint must be set in the Inspector.");
         SetMaintainMode();
     }
     else
     {
         curMode        = userMode = DroneMode.Patrol;
         targetBehavior = targetWaypointBehavior;
         targetBehavior.DroneTargetInit(thisScript);
         // Find the closest waypoint.  This may be any of the waypoints if the drone has been controlled manually.
         DroneWaypointScript wpScript = nextWaypoint.GetComponent <DroneWaypointScript>();
         nextWaypoint = wpScript.NearestWaypoint(transform.position);
         //prevWaypoint = null;
         target          = nextWaypoint.transform.position;
         effectiveTarget = targetBehavior.GetEffectiveTarget(transform, target, thisScript);
         EnterAdjustHeightState();
     }
 }
Esempio n. 5
0
 public void updateWorkerType(DroneMode newType)
 {
     droneMode = newType;
 }
 public void SetFollowMode()
 {
     if (!followee)
     {
         Debug.LogError("ERROR:  Followee needs to be set in the inspector.");
         SetMaintainMode();
     }
     else if (curFollowMode == DroneFollowMode.Constrained && !nextWaypoint)
     {
         Debug.LogError("Error:  nextWaypoint must be set in the Inspector.");
         SetMaintainMode();
     }
     else
     {
         curMode = userMode = DroneMode.Follow;
         if (userFollowMode == DroneFollowMode.Constrained)
             targetBehavior = targetConstrainedBehavior;
         else // (userFollowMode == DroneFollowMode.Direct)
             targetBehavior = targetDirectBehavior;
         targetBehavior.DroneTargetInit(thisScript);
         // Set the target to be the followee (XZ), but at the same height as the drone (Y).
         target = GeometryClass.TargetSameHeight(transform.position, followee.transform.position);
         effectiveTarget = targetBehavior.GetEffectiveTarget(transform, target, thisScript);
         EnterAdjustLateralState();
     }
 }
 public void SetPatrolMode()
 {
     if (!nextWaypoint)
     {
         Debug.LogError("Error:  nextWaypoint must be set in the Inspector.");
         SetMaintainMode();
     }
     else
     {
         curMode = userMode = DroneMode.Patrol;
         targetBehavior = targetWaypointBehavior;
         targetBehavior.DroneTargetInit(thisScript);
         // Find the closest waypoint.  This may be any of the waypoints if the drone has been controlled manually.
         DroneWaypointScript wpScript = nextWaypoint.GetComponent<DroneWaypointScript>();
         nextWaypoint = wpScript.NearestWaypoint(transform.position);
         //prevWaypoint = null;
         target = nextWaypoint.transform.position;
         effectiveTarget = targetBehavior.GetEffectiveTarget(transform, target, thisScript);
         EnterAdjustHeightState();
     }
 }
    public void SetManualMode()
    {
        // REALSENSE 

        /* Initialize a PXCMSenseManager instance */
        sm = PXCMSenseManager.CreateInstance();
        if (sm == null)
            Debug.LogError("SenseManager Initialization Failed");

        /* Enable hand tracking and retrieve an hand module instance to configure */
        sts = sm.EnableHand();
        handAnalyzer = sm.QueryHand();
        if (sts != pxcmStatus.PXCM_STATUS_NO_ERROR)
            Debug.LogError("PXCSenseManager.EnableHand: " + sts);

        /* Initialize the execution pipeline */
        sts = sm.Init();
        if (sts != pxcmStatus.PXCM_STATUS_NO_ERROR)
            Debug.LogError("PXCSenseManager.Init: " + sts);

        /* Retrieve the the DataSmoothing instance */
        sm.QuerySession().CreateImpl<PXCMSmoother>(out smoother);

        /* Create a 3D Weighted algorithm */
        smoother3D = new PXCMSmoother.Smoother3D[MaxHands][];

        /* Configure a hand - Enable Gestures and Alerts */
        PXCMHandConfiguration hcfg = handAnalyzer.CreateActiveConfiguration();
        if (hcfg != null)
        {
            hcfg.EnableAllGestures();
            hcfg.EnableAlert(PXCMHandData.AlertType.ALERT_HAND_NOT_DETECTED);
            hcfg.SubscribeGesture(OnFiredGesture);
            hcfg.ApplyChanges();
            hcfg.Dispose();
        }



      //  handAnalyzer = sm.QueryHand();

        //////

        curMode = userMode = DroneMode.Manual;
        targetBehavior = targetDirectBehavior;
        EnterFreeMovementState();
    }
 public void SetLandMode()
 {
     curMode = userMode = DroneMode.Land;
     targetBehavior = targetDirectBehavior;
     target = transform.position;
     target.y = droneScr.HeightOfGround();
     effectiveTarget = targetBehavior.GetEffectiveTarget(transform, target, thisScript);
     EnterLandingState();
 }
 public void SetHoverMode()
 {
     curMode = userMode = DroneMode.Hover;
     targetBehavior = targetDirectBehavior;
     target = transform.position;
     target.y = hoverHeight;
     effectiveTarget = targetBehavior.GetEffectiveTarget(transform, target, thisScript);
     EnterAdjustHeightState();
 }
 public void SetMaintainMode()
 {
     curMode = userMode = DroneMode.Maintain;
     targetBehavior = targetDirectBehavior;
     EnterAtDestinationState();
 }
Esempio n. 12
0
 public void SetManualMode()
 {
     curMode        = userMode = DroneMode.Manual;
     targetBehavior = targetDirectBehavior;
     EnterFreeMovementState();
 }
Esempio n. 13
0
 public void SetMaintainMode()
 {
     curMode        = userMode = DroneMode.Maintain;
     targetBehavior = targetDirectBehavior;
     EnterAtDestinationState();
 }
Esempio n. 14
0
 private void RevertToRoam()
 {
     CancelInvoke("StayOnTarget");
     currentState = DroneMode.Roam;
     InvokeRepeating("NewDestination", 3.0f, 3.0f);
 }