public virtual void Awake()
    {
        agent = gameObject.GetComponent <NavMeshAgent>();

        //Patrol instance START
        points = new Vector3[patrolWaypoints.Length];

        for (int i = 0; i < patrolWaypoints.Length; i++)
        {
            if (!moveYAxis)
            {
                points[i] = new Vector3(patrolWaypoints[i].transform.position.x, transform.position.y, patrolWaypoints[i].transform.position.z);
            }
            else
            {
                points[i] = new Vector3(patrolWaypoints[i].transform.position.x, patrolWaypoints[i].transform.position.y, patrolWaypoints[i].transform.position.z);
            }
        }

        if (points.Length == 1)
        {
            vectorIndex = 0;
        }
        //Patrol instance END

        enemyStats  = GetComponent <EnemyStats>();
        enemyAttack = GetComponent <Attack>();
        enemyAttack.setMoveYAxis(moveYAxis);

        if (enemyStats.spriteObject != null)
        {
            enemyAnimator = enemyStats.spriteObject.GetComponent <Animator>();
            hashAnimator  = enemyStats.spriteObject.GetComponent <HashAnimatorUnit>();
        }
    }
示例#2
0
    void Awake()
    {
        navMeshAgent = GetComponent <NavMeshAgent>();
        unitStats    = GetComponent <UnitStats>();

        attackDelayCount = unitStats.attackDelay;

        isRanged = unitStats.attackRange > 0f;

        if (gameObject.tag == Tags.player)
        {
            targetTag = Tags.enemy;
        }
        if (gameObject.tag == Tags.enemy)
        {
            targetTag = Tags.player;
        }

        if (projectileSpawnPoint == null)
        {
            projectileSpawnPoint = transform;
        }

        if (unitStats.spriteObject != null)
        {
            animator         = unitStats.spriteObject.GetComponent <Animator>();
            hashAnimatorUnit = unitStats.spriteObject.GetComponent <HashAnimatorUnit>();
        }
    }
    public virtual void Awake()
    {
        agent = gameObject.GetComponent<NavMeshAgent>();

        //Patrol instance START
        points = new Vector3[patrolWaypoints.Length];

        for(int i=0; i<patrolWaypoints.Length; i++ ){
            if(!moveYAxis){
                points[i] = new Vector3(patrolWaypoints[i].transform.position.x, transform.position.y, patrolWaypoints[i].transform.position.z);
            }else{
                points[i] = new Vector3(patrolWaypoints[i].transform.position.x, patrolWaypoints[i].transform.position.y, patrolWaypoints[i].transform.position.z);
            }
        }

        if(points.Length == 1){
            vectorIndex = 0;
        }
        //Patrol instance END

        enemyStats = GetComponent<EnemyStats>();
        enemyAttack = GetComponent<Attack>();
        enemyAttack.setMoveYAxis(moveYAxis);

        if(enemyStats.spriteObject != null){
            enemyAnimator = enemyStats.spriteObject.GetComponent<Animator>();
            hashAnimator = enemyStats.spriteObject.GetComponent<HashAnimatorUnit>();
        }
    }
示例#4
0
    public virtual void Awake()
    {
        enemyStats = GetComponent<EnemyStats>();
        enemyAttack = GetComponent<Attack>();
        enemyAttack.setMoveYAxis(moveYAxis);
        enemyAttack.setMoveToAttack(false);

        if(enemyStats.spriteObject != null){
            enemyAnimator = enemyStats.spriteObject.GetComponent<Animator>();
            hashAnimator = enemyStats.spriteObject.GetComponent<HashAnimatorUnit>();
        }
    }
    void Awake()
    {
        navMeshAgent = GetComponent <NavMeshAgent>();
        playerAttack = GetComponent <Attack>();
        playerAttack.setMoveYAxis(moveYAxis);
        playerStats = GetComponent <UnitStats>();

        if (playerStats.spriteObject != null)
        {
            animator         = playerStats.spriteObject.GetComponent <Animator>();
            hashAnimatorUnit = playerStats.spriteObject.GetComponent <HashAnimatorUnit>();
        }
    }
示例#6
0
    public virtual void Awake()
    {
        enemyStats  = GetComponent <EnemyStats>();
        enemyAttack = GetComponent <Attack>();
        enemyAttack.setMoveYAxis(moveYAxis);
        enemyAttack.setMoveToAttack(false);

        if (enemyStats.spriteObject != null)
        {
            enemyAnimator = enemyStats.spriteObject.GetComponent <Animator>();
            hashAnimator  = enemyStats.spriteObject.GetComponent <HashAnimatorUnit>();
        }
    }
示例#7
0
    public virtual void Awake()
    {
        life = startingLife;
        navMeshAgent = GetComponent<NavMeshAgent>();
        colliderComponent = GetComponent<Collider>();

        speed = navMeshAgent.speed;

        if(spriteObject != null){
            animator = spriteObject.GetComponent<Animator>();
            hashAnimatorUnit = spriteObject.GetComponent<HashAnimatorUnit>();
        }

        if(footPosition == null){
            footPosition = this.transform;
        }
    }
示例#8
0
    public virtual void Awake()
    {
        life              = startingLife;
        navMeshAgent      = GetComponent <NavMeshAgent>();
        colliderComponent = GetComponent <Collider>();

        speed = navMeshAgent.speed;

        if (spriteObject != null)
        {
            animator         = spriteObject.GetComponent <Animator>();
            hashAnimatorUnit = spriteObject.GetComponent <HashAnimatorUnit>();
        }

        if (footPosition == null)
        {
            footPosition = this.transform;
        }
    }
示例#9
0
    void Awake()
    {
        navMeshAgent = GetComponent<NavMeshAgent>();
        unitStats = GetComponent<UnitStats>();

        attackDelayCount = unitStats.attackDelay;

        isRanged = unitStats.attackRange > 0f;

        if(gameObject.tag == Tags.player){
            targetTag = Tags.enemy;
        }
        if(gameObject.tag == Tags.enemy){
            targetTag = Tags.player;
        }

        if(projectileSpawnPoint == null){
            projectileSpawnPoint = transform;
        }

        if(unitStats.spriteObject != null){
            animator = unitStats.spriteObject.GetComponent<Animator>();
            hashAnimatorUnit = unitStats.spriteObject.GetComponent<HashAnimatorUnit>();
        }
    }
示例#10
0
 void Awake()
 {
     animator         = GetComponent <Animator>();
     hashAnimatorUnit = GetComponent <HashAnimatorUnit>();
 }
 void Awake()
 {
     animator = GetComponent<Animator>();
     hashAnimatorUnit = GetComponent<HashAnimatorUnit>();
 }
    void Awake()
    {
        navMeshAgent = GetComponent<NavMeshAgent>();
        playerAttack = GetComponent<Attack>();
        playerAttack.setMoveYAxis(moveYAxis);
        playerStats = GetComponent<UnitStats>();

        if(playerStats.spriteObject != null){
            animator = playerStats.spriteObject.GetComponent<Animator>();
            hashAnimatorUnit = playerStats.spriteObject.GetComponent<HashAnimatorUnit>();
        }
    }