void OnCollisionEnter(Collision col) { AgentModule module = col.gameObject.GetComponent <AgentModule>(); if (module != null) { Agent colAgent = module.Agent; if (colAgent != null) { if (colAgent.AgentType == AgentType.Enemy) { if (Agent.AgentType == AgentType.Actor) { GlobalMessageBus.Instance.PublishEvent(new HpBarChangedMessage(colAgent, col.gameObject, 1)); RandomMoveTo(); } } if (colAgent.AgentType == AgentType.Actor) { if (Agent.AgentType == AgentType.Enemy) { GlobalMessageBus.Instance.PublishEvent(new HpBarChangedMessage(colAgent, col.gameObject, 1)); GlobalMessageBus.Instance.PublishEvent(new ActorHitMessage(colAgent, Agent, 1)); Stop(); RandomMoveTo(); StartCoroutine(ReAssignEnemy()); } } } } }
public Agent(AgentModule module, AgentType type, int hp) { AgentModule = module; AgentModule.Agent = this; ActiveEmotions = new List<Emotion>(); ActiveEmotionPairs = new Dictionary<ActiveEmotionPair, float>(); AgentType = type; HP = hp; EmotionState = EmotionState.resilent; }
public Agent(AgentModule module, AgentType type, int hp) { AgentModule = module; AgentModule.Agent = this; ActiveEmotions = new List <Emotion>(); ActiveEmotionPairs = new Dictionary <ActiveEmotionPair, float>(); AgentType = type; HP = hp; EmotionState = EmotionState.resilent; }