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