Esempio n. 1
0
 private void Awake()
 {
     _aiFieldOfView = GetComponent <AiFieldOfView>();
     _aiPathfinding = GetComponent <AiPathfinding>();
     _aiAttack      = GetComponent <AiAttack>();
     _animator      = GetComponent <Animator>();
 }
Esempio n. 2
0
 public override void Start()
 {
     base.Start();
     spriteRenderer          = GetComponent <SpriteRenderer>();
     enemyAttack             = gameObject.GetComponent <AiAttack>();
     enemyMovement           = gameObject.GetComponent <AiMovement>();
     colliderList            = gameObject.GetComponentsInChildren <Collider2D>();
     dataToPassBetweenScenes = GameObject.FindGameObjectWithTag("PassData").GetComponent <DataToPassBetweenScenes>();
     player = GameObject.Find("MyCharacter");
 }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        distance     = (enemy.position - player.position);
        distance.y   = 0;
        distanceFrom = distance.magnitude;
        distance    /= distanceFrom;


        if (distanceFrom < 20)
        {
            ProgressAlongPathSpeed speed  = GetComponent <ProgressAlongPathSpeed>();
            ProgressAlongPathTime  time   = GetComponent <ProgressAlongPathTime>();
            RotateToMovement       rotate = GetComponent <RotateToMovement>();
            AiAttack attack = GetComponent <AiAttack>();
            AIMove   move   = GetComponent <AIMove>();

            speed.enabled  = false;
            time.enabled   = false;
            rotate.enabled = false;
            attack.enabled = true;
            move.enabled   = true;
        }
        else
        {
            ProgressAlongPathSpeed speed  = GetComponent <ProgressAlongPathSpeed>();
            ProgressAlongPathTime  time   = GetComponent <ProgressAlongPathTime>();
            RotateToMovement       rotate = GetComponent <RotateToMovement>();
            AiAttack attack = GetComponent <AiAttack>();
            AIMove   move   = GetComponent <AIMove>();

            speed.enabled  = true;
            time.enabled   = true;
            rotate.enabled = true;
            attack.enabled = false;
            move.enabled   = false;
        }
    }
Esempio n. 4
0
 void Awake()
 {
     Player       = GameObject.FindWithTag("Player").transform;
     _enemyattack = GetComponent <AiAttack>();
     rb           = GetComponent <Rigidbody>();
 }