public AnimalInputHandler(ISpeciesInterface inSpeciesInterface) : base() { _species = inSpeciesInterface; ButtonResponses.Add(EInputKey.PositiveAnimalCry, OnPositiveAnimalCry); ButtonResponses.Add(EInputKey.NegativeAnimalCry, OnNegativeAnimalCry); }
public WildlifeEntry(GameObject inWildlifeEntry) { Valid = true; WildlifeGameObject = inWildlifeEntry; WildlifeSpeciesInterface = WildlifeGameObject.GetComponent <ISpeciesInterface>(); if (WildlifeSpeciesInterface == null) { Debug.LogError("Tried to add a wildlife entry that lacks a proper species interface!"); Valid = false; } }
public FollowTargetGoal(GameObject inOwner, FollowTargetGoalParams inParams, IWildlifeServiceInterface inWildlifeServiceInterface) : base(inOwner) { _params = inParams; _followRadiusSquared = Mathf.Pow(_params.FollowRadius, 2); _wildlifeServiceInterface = inWildlifeServiceInterface; _ownerSpeciesInterface = inOwner.GetComponent <ISpeciesInterface>(); _ownerPathfindingInterface = inOwner.GetComponent <IPathfindingInterface>(); _currentStatus = EGoalStatus.Inactive; }
public override EGoalStatus Update(float inDeltaTime) { if (_currentStatus == EGoalStatus.InProgress) { if (_currentTarget == null || VectorFunctions.DistanceSquared(Owner.transform.position, _currentTarget.transform.position) > _params.LoseFollowRadiusSquared || _currentTargetSpeciesInterface.IsSpeciesCryInProgress(ECryType.Negative)) { _currentTarget = null; _currentTargetSpeciesInterface = null; _currentStatus = EGoalStatus.Failed; } } return(_currentStatus); }
public override float CalculateDesirability() { if (_currentTarget == null) { var localWildlife = _wildlifeServiceInterface.GetWildlifeInRadius(Owner.transform.position, _params.FollowRadius); foreach (var localAnimal in localWildlife) { if (IsMatchingAnimalCallingYou(localAnimal.Wildlife) && localAnimal.DistanceSquared < _followRadiusSquared) { _currentTarget = localAnimal.WildlifeGameObject; _currentTargetSpeciesInterface = localAnimal.Wildlife; break; } } } if (_currentTarget == null) { return(0.0f); } return(_params.ValidTargetDesirability); }
public LocalWildlifeResult(WildlifeService.WildlifeEntry inEntry, float inDistanceSquared) { Wildlife = inEntry.WildlifeSpeciesInterface; WildlifeGameObject = inEntry.WildlifeGameObject; DistanceSquared = inDistanceSquared; }
private bool IsMatchingAnimalCallingYou(ISpeciesInterface species) { return(species.IsSpeciesCryInProgress(ECryType.Positive) && species.GetCurrentSpeciesType() == _ownerSpeciesInterface.GetCurrentSpeciesType()); }