private void OnTriggerExit(Collider other)
 {
     if (other.tag == "TaskLocation")
     {
         TaskLocation location = other.GetComponent <TaskLocation>();
         if (location == null)
         {
             return;
         }
         if (_currentLocation == location)
         {
             _currentLocation = null;
         }
     }
     else if (other.tag == "Pickup")
     {
         var pickup = other.GetComponent <Pickup>();
         if (_currentPickup == pickup)
         {
             _currentPickup = null;
         }
     }
     else if (other.tag == "PickupBox")
     {
         _consumeBox = null;
     }
 }
Exemplo n.º 2
0
        static unsafe void Main(string[] args)
        {
            //PositionClient v = new PositionClient();

            //v.initSocket();
            //int i = 0;
            //while(!i.Equals(100))
            //{
            //    v.RecevieData();
            //    AR.Drone.MyTool.diyPosition _p = *( AR.Drone.MyTool.diyPosition *) v.getPosition1();
            //    Console.WriteLine("1:" + _p.x + "," + _p.y + "," + _p.z + ",");
            //    _p = *(AR.Drone.MyTool.diyPosition*)v.getPosition2();
            //    Console.WriteLine("2:" + _p.x + "," + _p.y + "," + _p.z + ",");
            //    Console.WriteLine(i);
            //    i++;
            //}

            TestRect t = new TestRect();
            UVATeam  u = new UVATeam(3);

            u.init(t);
            TaskLocation.location(u);


            Console.ReadKey();
        }
Exemplo n.º 3
0
        public static TaskLocation NewLocation()
        {
            Guid id = Guid.NewGuid();
            string path = Path.Combine(RootPath, id.ToString("B"));

            TaskLocation location = new TaskLocation(id, path);
            s_locations.Add(id, location);

            Directory.CreateDirectory(location.LocationPath);

            return location;
        }
Exemplo n.º 4
0
    public EntityTask(Entity entity, TaskLocation tl, float priority, float taskTime = -1, string taskDesc = null)
    {
        TaskDescription = taskDesc;
        Entity          = entity;
        Priority        = priority;
        IsComplete      = false;
        TaskTime        = taskTime;
        Location        = tl;
        HasTaskLocation = true;

        if (taskDesc != null)
        {
            if (entity.GetLoadedEntity() != null)
            {
                entity.GetLoadedEntity().SpeechBubble.PushMessage(taskDesc);
            }
        }
    }
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "TaskLocation")
     {
         TaskLocation location = other.GetComponent <TaskLocation>();
         if (location != null)
         {
             _currentLocation = location;
         }
     }
     else if (other.tag == "Pickup")
     {
         _currentPickup = other.GetComponent <Pickup>();
     }
     else if (other.tag == "PickupBox")
     {
         _consumeBox = other.GetComponent <ConsumeBox>();
     }
 }
 public void OnAction(InputValue inputValue)
 {
     if (inputValue.isPressed && _currentLocation != null && State == PlayerState.IDLE)
     {
         int performerNumber = _currentLocation.Performing;
         if (performerNumber < _currentLocation.Task.RequiredPlayerCount)
         {
             // interact with location without item
             State = PlayerState.INTERACTING;
             Animator.SetTrigger(_currentLocation.GetAnimationString());
             var animationTransform = _currentLocation.Locations[performerNumber];
             transform.SetPositionAndRotation(animationTransform.position, animationTransform.rotation);
             _currentLocation.Performing++;
             _rb.isKinematic = true;
             // hold item if the task has one
             if (_currentLocation.Task.ItemtoHold != null)
             {
                 var item = Instantiate(_currentLocation.Task.ItemtoHold, HoldingHand.position, HoldingHand.rotation);
                 item.transform.parent = HoldingHand;
             }
             if (_currentLocation.Task.Synchronized)
             {
                 _currentLocation.UpdateSynchronizedTime += OnAnimationTimeSynchronization;
             }
             _performingLocation = _currentLocation;
         }
     }
     else if (!inputValue.isPressed && State == PlayerState.INTERACTING)
     {
         // stop interacting
         State = PlayerState.IDLE;
         _performingLocation.Performing--;
         Animator.SetTrigger("walk");
         _rb.isKinematic = false;
         // Destroy all held items
         {
             foreach (Transform child in HoldingHand)
             {
                 Destroy(child.gameObject);
             }
         }
         if (_performingLocation.Task.Synchronized)
         {
             _performingLocation.UpdateSynchronizedTime -= OnAnimationTimeSynchronization;
         }
         _performingLocation = null;
     }
     else if (inputValue.isPressed && _currentPickup != null && State == PlayerState.IDLE)
     {
         // pick up item
         _currentPickup.Take();
         _currentPickup.transform.SetPositionAndRotation(HoldingHand.position, HoldingHand.rotation);
         _currentPickup.transform.SetParent(HoldingHand);
         _rb.isKinematic = true;
         State           = PlayerState.ANIMATION;
         Animator.SetTrigger("lift");
     }
     else if (inputValue.isPressed && State == PlayerState.HOLDING)
     {
         if (_currentLocation != null && _currentLocation.Task.RequiresPot && _currentLocation.Performing == 0)
         {
             // use item on location
             foreach (Transform child in HoldingHand)
             {
                 Destroy(child.gameObject);
             }
             Animator.SetTrigger(_currentLocation.Task.PotString);
             _currentLocation.FillUp();
             _rb.isKinematic = true;
             var animationTransform = _currentLocation.Locations[0];
             transform.SetPositionAndRotation(animationTransform.position, animationTransform.rotation);
             State = PlayerState.ANIMATION;
         }
         else
         {
             // drop item
             var pickup = HoldingHand.GetChild(0).GetComponent <Pickup>();
             pickup.PutDown();
             HoldingHand.DetachChildren();
             Animator.SetTrigger("walk");
             State = PlayerState.IDLE;
         }
     }
     else if (inputValue.isPressed && State == PlayerState.IDLE && _consumeBox != null)
     {
         // pick up item
         Pickup pickup = Instantiate(_consumeBox.JugPrefab).GetComponent <Pickup>();
         pickup.Take();
         pickup.transform.SetPositionAndRotation(HoldingHand.position, HoldingHand.rotation);
         pickup.transform.SetParent(HoldingHand);
         _rb.isKinematic = true;
         State           = PlayerState.ANIMATION;
         Animator.SetTrigger("lift");
     }
 }
Exemplo n.º 7
0
 public void SetTaskLocation(TaskLocation tl)
 {
     Location        = tl;
     HasTaskLocation = true;
 }