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();
        }
Exemplo n.º 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>();
     }
 }
Exemplo n.º 3
0
 protected AIState(AIMovement movement)
 {
     this.movement = movement;
 }
Exemplo n.º 4
0
 void Awake()
 {
     instance             = this;
     this._characterModel = this.transform.GetChild(0).gameObject;
     AIController.instance.charactorAnimator = this._characterModel.GetComponent <Animator>() as Animator;
 }
Exemplo n.º 5
0
 void Awake() {
     instance = this;
     this._characterModel = this.transform.GetChild(0).gameObject;
     AIController.instance.charactorAnimator = this._characterModel.GetComponent<Animator>() as Animator;
 }