Пример #1
0
    Toteable MostAttractiveOption(ICollection <Entity> discoveredEntities)
    {
        Toteable mostAttractive = null;
        float    bestDistance   = 0;

        foreach (Toteable toteable in discoveredEntities)
        {
            if (mostAttractive == null)
            {
                mostAttractive = toteable;
                bestDistance   = Vector3.Distance(psycheEnv.gameObject.transform.position, toteable.gameObject.transform.position);
            }
            else
            {
                float newDistance = Vector3.Distance(psycheEnv.gameObject.transform.position, toteable.gameObject.transform.position);
                if (newDistance < bestDistance)
                {
                    if (mostAttractive.beingHeld && !toteable.beingHeld)
                    {
                        mostAttractive = toteable;
                    }
                }
            }
        }
        return(mostAttractive);
    }
Пример #2
0
 private void OnAnyItemPickup(Character character, Toteable toteable)
 {
     if (toteable == locatedToteable && character != psycheEnv.character)
     {
         locatedToteable = null;
     }
 }
Пример #3
0
 private void OnAnyItemPickup(Character character, Toteable toteable)
 {
     if (toteable == targetToteable && character != psycheEnv.character)
     {
         psycheEnv.brain.PopState();
     }
 }
Пример #4
0
 public void ReceiveReport(ICollection <Entity> entities)
 {
     locatedToteable = MostAttractiveOption(entities);
     if (locatedToteable != null)
     {
         EventHub.PickupEvent += OnAnyItemPickup;
     }
 }
Пример #5
0
 public void PickUpItem(Toteable toteable)
 {
     heldItems.Add(toteable);
     toteable.gameObject.SetActive(false);
     toteable.beingHeld = true;
     toteable.holder    = this;
     EventHub.PickupBroadcast(this, toteable);
 }
Пример #6
0
 public static void PickupBroadcast(Character character, Toteable toteable)
 {
     PickupEvent?.Invoke(character, toteable);
 }
Пример #7
0
 public void LoadNecessaryData(Toteable desiredToteable)
 {
     this.desiredToteable = desiredToteable;
 }
Пример #8
0
 public ApproachAndRobMotion(PsycheEnv psycheEnv, Toteable targetObject) : base(psycheEnv)
 {
     this.targetObject = targetObject;
 }
Пример #9
0
 public ApproachAndPickupState(PsycheEnv psycheEnv, Toteable targetToteable) : base(psycheEnv)
 {
     this.targetToteable   = targetToteable;
     EventHub.PickupEvent += OnAnyItemPickup;
 }
Пример #10
0
 public ApproachAndRobState(PsycheEnv psycheEnv, Toteable targetToteable) : base(psycheEnv)
 {
     this.targetToteable = targetToteable;
 }