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); }
private void OnAnyItemPickup(Character character, Toteable toteable) { if (toteable == locatedToteable && character != psycheEnv.character) { locatedToteable = null; } }
private void OnAnyItemPickup(Character character, Toteable toteable) { if (toteable == targetToteable && character != psycheEnv.character) { psycheEnv.brain.PopState(); } }
public void ReceiveReport(ICollection <Entity> entities) { locatedToteable = MostAttractiveOption(entities); if (locatedToteable != null) { EventHub.PickupEvent += OnAnyItemPickup; } }
public void PickUpItem(Toteable toteable) { heldItems.Add(toteable); toteable.gameObject.SetActive(false); toteable.beingHeld = true; toteable.holder = this; EventHub.PickupBroadcast(this, toteable); }
public static void PickupBroadcast(Character character, Toteable toteable) { PickupEvent?.Invoke(character, toteable); }
public void LoadNecessaryData(Toteable desiredToteable) { this.desiredToteable = desiredToteable; }
public ApproachAndRobMotion(PsycheEnv psycheEnv, Toteable targetObject) : base(psycheEnv) { this.targetObject = targetObject; }
public ApproachAndPickupState(PsycheEnv psycheEnv, Toteable targetToteable) : base(psycheEnv) { this.targetToteable = targetToteable; EventHub.PickupEvent += OnAnyItemPickup; }
public ApproachAndRobState(PsycheEnv psycheEnv, Toteable targetToteable) : base(psycheEnv) { this.targetToteable = targetToteable; }