Esempio n. 1
0
        private void OnCharacterSpawned(BaseCharacterController character)
        {
            AgentController agent = character as AgentController;

            if (agent != null)
            {
                CharacterFaction faction = agent.Config.Faction;
                if (!_agentsByFaction[faction].Contains(agent))
                {
                    _agentsByFaction[faction].Add(agent);
                }

                if (!_hostileToPlayer.ContainsKey(agent))
                {
                    _hostileToPlayer[agent] = false;
                }
            }
            else if (Player == null)
            {
                //Must be a player
                Player = character as PlayerController;
                Debug.Assert(Player != null);
            }
        }
Esempio n. 2
0
 public bool IsHostileToPlayer(AgentController agent)
 {
     return(_hostileToPlayer[agent]);
 }
Esempio n. 3
0
 public void EndHostilityToPlayer(AgentController agent)
 {
     agent.RemoveEnemy(CharacterFaction.Player);
     Player.RemoveEnemy(agent.Config.Faction);
     _hostileToPlayer[agent] = false;
 }
Esempio n. 4
0
        public bool CanSeeCharacter(AgentController agent, BaseCharacterController other)
        {
            float distance = Vector3.Distance(other.transform.position, agent.transform.position);

            return(LineOfSightCheck(agent.transform, other.transform, agent._agentConfig.VisionRange));
        }
Esempio n. 5
0
 private float DistanceThreshold(AgentController owner)
 {
     return(_minePointDistanceThresholdBase + (owner.GetAbsoluteDesireValue(DesireType.Money) - _moneyDesireThreshold));
 }
Esempio n. 6
0
 public void MarkAsHostileToPlayer(AgentController agent)
 {
     agent.AddEnemy(CharacterFaction.Player);
     Player.AddEnemy(agent.Config.Faction);
     _hostileToPlayer[agent] = true;
 }
Esempio n. 7
0
 public override bool ShouldRunState(AgentController owner, out StateConfig config)
 {
     config = null;
     return(false);
 }
Esempio n. 8
0
 public MineCurrencyConfig(AgentController Owner, Inventory toMine) : base(States.Mine, StatePriority.LongTerm, Owner)
 {
     ToMine = toMine;
 }
Esempio n. 9
0
 public FleeConfig(AgentController owner, BaseCharacterController attacker) : base(States.Flee, StatePriority.Immediate, owner)
 {
     Attacker = attacker;
 }
Esempio n. 10
0
 public StealConfig(Inventory stealFrom, AgentController owner) : base(States.Steal, StatePriority.LongTerm, owner)
 {
     ToStealFrom = stealFrom;
 }
Esempio n. 11
0
 public IdleConfig(AgentController owner, float maxWaitDuration, StatePriority prio = StatePriority.LongTerm) :
     base(States.Idle, prio, owner)
 {
     MaxWaitDuration = maxWaitDuration;
 }
Esempio n. 12
0
 public MoveToConfig(Vector2 target, AgentController owner, float tolerance = 2.0f)
     : base(States.MoveTo, StatePriority.Immediate, owner)
 {
     Target    = target;
     Tolerance = tolerance;
 }
Esempio n. 13
0
 public AttackConfig(AgentController owner, BaseCharacterController target)
     : base(States.Attack, StatePriority.Normal, owner)
 {
     Target = target;
 }