void Awake()
    {
        _motor    = transform.parent.GetComponent <EnemyMovementMotor>();
        _animator = transform.parent.GetComponent <EnemyAnimatorController>();
        _health   = transform.parent.GetComponent <EnemyHealth>();

        _soundBank  = transform.parent.GetComponentInChildren <EnemySoundBank>();
        _pathFinder = transform.parent.GetComponentInChildren <PathFinder>();

        _patrolAi  = GetComponent <PatrolBehaviour>();
        _pursueAi  = GetComponent <PursueBehaviour>();
        _exploreAi = GetComponent <ExploreBehaviour>();
    }
    public void cast()
    {
        if (Vector3.Distance(gameObject.transform.position, agent.target.direct.position) <= maxRange)
        {
            GameObject instantiatedObject = (GameObject)Instantiate(abilityObject, abilitySpawnLoc);
            objectAgent = instantiatedObject.GetComponent <AgentManager>();
            objectAgent.SendMessage("Start");
            objectAgent.team = agent.team;
            objectAgent.type = AgentType.AbilityEffect;

            MovementBehaviour behaviour = new PursueBehaviour(agent.target.agent, true);
            objectAgent.mover.AddBehaviour(behaviour);
        }
    }
 /// <summary>
 /// Constructor for pursue behaviour.
 /// </summary>
 /// <param name="behaviour">
 /// Details for this behaviour.
 /// </param>
 /// <param name="parentBehaviour">
 /// Reference to component to decorate.
 /// </param>
 public PursueBehaviourDecorator(AbstractBehaviourComponent parentBehaviour, MovementBehaviour behaviour)
     : base(parentBehaviour, behaviour)
 {
     this.behaviour = behaviour as PursueBehaviour;
 }
Beispiel #4
0
 ///<summary>
 ///Sets where to attack behavior based on whether the creep is a big one or a small one
 ///</summary>
 public void setAttackBehavior()
 {
     attackBehavior = new PursueBehaviour(agent.target.direct, true);
 }