private void Initiate()
        {
            if (!playerTransform)
            {
                playerTransform = GameObject.FindGameObjectWithTag("Player").transform;
            }
            if (!movement)
            {
                movement = GetComponent <AIMovement>();
            }
            if (!ps)
            {
                ps = GetComponent <PlatformerPhysicsSim>();
            }
            if (!rb)
            {
                rb = GetComponent <Rigidbody>();
            }
            if (!hitInfo)
            {
                hitInfo = GetComponentInChildren <RaycastHitInfo>();
            }
            damageDealer = GetComponent <DamageDealer>();

            // attack range to be <= to chase distance
            attackRange = Mathf.Min(attackRange, chaseDistance);
            InitiateAIBrain();
        }
Exemple #2
0
 private void Start()
 {
     if (!targetTransform)
     {
         targetTransform = GameObject.FindGameObjectWithTag("Player").transform;
     }
     if (!controller)
     {
         controller = GetComponentInParent <AIController>();
     }
     if (!movement)
     {
         movement = controller.GetComponent <AIMovement>();
     }
     if (!body)
     {
         body = GetComponentInParent <Transform>();
     }
 }
Exemple #3
0
 protected AIState(AIMovement movement)
 {
     this.movement = movement;
 }
Exemple #4
0
 void Awake()
 {
     instance             = this;
     this._characterModel = this.transform.GetChild(0).gameObject;
     AIController.instance.charactorAnimator = this._characterModel.GetComponent <Animator>() as Animator;
 }
Exemple #5
0
 void Awake() {
     instance = this;
     this._characterModel = this.transform.GetChild(0).gameObject;
     AIController.instance.charactorAnimator = this._characterModel.GetComponent<Animator>() as Animator;
 }