Example #1
0
 // Use this for initialization
 void Start()
 {
     _health       = GetComponent <EnemyHealth> ();
     _chase        = GetComponent <EnemyChasing> ();
     _patrol       = GetComponent <EnemyPatrolling> ();
     _movement     = GetComponent <EnemyMovement>();
     _isPatrolling = true;//TEMP
 }
Example #2
0
    void Start() //avant c'était Awake
    {
        // Setting up the references.
        player = GameObject.FindGameObjectWithTag("Player");
        //Debug.Log(player);
        //playerHealth = player.currentHealth;
        characterHealth = player.GetComponent <CharacterHealth>();
        //enemyHealth = GetComponent<EnemyHealth>();
        anim = GetComponent <Animator>();

        enemyPatrolling = GetComponent <EnemyPatrolling>();
        enemyChasing    = GetComponent <EnemyChasing>();
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        _movement  = GetComponent <EnemyMovement>();
        _chase     = GetComponent <EnemyChasing> ();
        _patrol    = GetComponent <EnemyPatrolling> ();
        _collision = GetComponent <CollisionHandler> ();

        _health    = GetComponent <HealthHandler> ();
        _trigger   = GetComponent <TriggerHandler> ();
        _knockback = GetComponent <EnemyKnockback>();

        _animator = GetComponent <EnemyAnimator> ();

        _isPatrolling = true;        //TEMP
    }
Example #4
0
	void Awake (){
		rigid = GetComponent<Rigidbody2D> ();
		GameObject playerObj = GameObject.FindGameObjectWithTag ("Player");
		if (playerObj != null) {
			target = playerObj.transform;
		}
		//Get all the Scripts needed;
		_enemy = GameObject.FindGameObjectWithTag("Enemy");
		if(_enemy != null){
			_enemyMove = _enemy.GetComponent<EnemyMove>();
			_enemyHealth = _enemy.GetComponent<EnemyHealth> ();
			_enemyShoot = _enemy.GetComponent<EnemyWeaponController> ();
			_enemyEvade = _enemy.GetComponent<EnemyEvasiveManouver> ();
			_enemyPatrol = _enemy.GetComponent<EnemyPatrolling> ();
			_enemyChasing = _enemy.GetComponent<EnemyChasing> ();
		} else {
			print("Something went Wrong; Could not find this Enemy "+this+" in this scene");
		}
	}
Example #5
0
    // Start is called before the first frame update
    void Start()
    {
        // Create patrolling points around This, randomly in the This range
        for (int i = 0; i < patrolPoints.Length; i++)
        {
            float xPos = Random.Range(transform.position.x - patrollingRangeX, transform.position.x + patrollingRangeX);
            float yPos = Random.Range(transform.position.y - patrollingRangeY, transform.position.y + patrollingRangeY);
            patrolPoints[i] = new Vector3(xPos, yPos, 0f);
            //Debug.Log(i);
        }

        currentPatrolIndex = 0;
        currentPatrolPoint = patrolPoints[currentPatrolIndex];
        anim         = GetComponent <Animator>();
        enemyChasing = GetComponent <EnemyChasing>();
        chasing      = enemyChasing.chasing;
        enemyAttack  = GetComponent <EnemyAttack>();
        anim.SetBool("Attacking", false);
    }
Example #6
0
 // Use this for initialization
 void Start()
 {
     _health = GetComponent <EnemyHealth>();
     _chase  = GetComponent <EnemyChasing>();
     _patrol = GetComponent <EnemyPatrolling>();
 }