Esempio n. 1
0
 //Checks if a Swork is out-of-bounds and moves it to the holding area
 public static void CollectOutOfBoundsSworks(Transform holdingArea)
 {
     for (int i = 0; i < AllSworks.Length; i++)
     {
         if (AllSworks[i].InStandby)
         {
             continue;
         }
         //dead if 'Out-of-Bounds'
         if (OutOfBounds(AllSworks[i].SwkTran.position)) //check if out-of-bounds
         {
             if (CurrentTargetSwork != null &&           //if it's 'Target'
                 AllSworks[i].GetInstanceID() == CurrentTargetSwork.GetInstanceID())
             {
                 StoredTarget = CurrentTargetSwork;
                 CurrentTargetSwork.CurrentState = SwkSwork.SworkStates.TargetOutOfBounds;
                 CurrentCamera.Focused           = false;
                 CurrentTargetSwork = null;
             }
             else
             {
                 StandBySworksQueue.Enqueue(AllSworks[i]);
             }
             AllSworks[i].MakeStandby(holdingArea.position);
         }
     }
 }
Esempio n. 2
0
        //find swork to target
        public static void TargetNearestSwork()
        {
            if (CurrentTargetSwork)
            {
                return;                                     //end; swork already targetted
            }
            //find nearest swork in range
            _nearestDistance = SwkGame.Tweaks.Game.ManualSelectionRange;
            foreach (SwkSwork swork in AllSworks)
            {
                _distance = Vector3.Distance(swork.SwkTran.position, CurrentInput.WorldPosition);
                if (_distance < _nearestDistance)
                {
                    _nearestDistance   = _distance;
                    _nearestSworkSoFar = swork;
                }
            }

            if (_nearestDistance == SwkGame.Tweaks.Game.ManualSelectionRange)
            {
                return;                                                              //end; no Swork in range
            }
            //target nearest
            CurrentTargetSwork = _nearestSworkSoFar;
            CurrentTargetSwork.CurrentState      = SwkSwork.SworkStates.TargetInPlay;
            CurrentGameState.CurrentControlState = GameState.ControlState.TargetAquired;
        }
Esempio n. 3
0
        // makes 'jumpPad' a child of 'swork' and moves into position
        private static void PickUpJumpPad(SwkSwork swork, SwkJumpPad jumpPad)
        {
            jumpPad.JmpPTran.parent        = swork.transform;
            _desiredPos                    = Vector3.zero;
            _desiredPos.x                  = SwkGame.Tweaks.JumpPad.CarryPositionX;
            _desiredPos.y                  = SwkGame.Tweaks.JumpPad.CarryPositionY;
            jumpPad.JmpPTran.localPosition = _desiredPos;

            swork.Carrying = true;
            jumpPad.MakeCarrying();
        }