Exemplo n.º 1
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     rb       = animator.GetComponent <Rigidbody2D>();
     pathfind = animator.GetComponent <EnemyPathfinding>();
     AI       = animator.GetComponent <EnemyAI>();
     player   = pathfind.GetTargetTransform();
 }
Exemplo n.º 2
0
 private void Awake()
 {
     enemyPathfinding = GetComponent <EnemyPathfinding>();
     enemyShoot       = GetComponent <EnemyShoot>();
     enemyWeapon      = transform.GetComponentInChildren <EnemyWeapon>();
     moveState        = MoveState.Roaming;
     attackState      = AttackState.Idle;
 }
Exemplo n.º 3
0
 protected void Start()
 {
     health           = maxHealth;
     room             = GameObject.FindGameObjectWithTag("RoomSpawner").GetComponent <RoomSpawner>().roomGrid.GetGridObject(transform.position);
     spriteRenderer   = GetComponent <SpriteRenderer>();
     animator         = GetComponent <Animator>();
     rb               = GetComponent <Rigidbody2D>();
     enemyPathfinding = GetComponent <EnemyPathfinding>();
 }
Exemplo n.º 4
0
    // Start is called before the first frame update
    protected virtual void Start()
    {
        pfScript     = GetComponent <EnemyPathfinding>();
        currentState = EnemyState.IDLE;

        attackTimer = 0.0f;

        anim = GetComponentInChildren <EnemyAnimation>();
    }
Exemplo n.º 5
0
 // Start is called before the first frame update
 void Awake()
 {
     pathfind         = GetComponent <EnemyPathfinding>();
     anime            = GetComponent <Animator>();
     eAttack          = GetComponent <EnemyAttack>();
     startingPosition = transform.position;
     //shoot = GetComponent<Shooting>();
     state = EnemyAIState.Spawning;
 }
Exemplo n.º 6
0
    protected virtual void Awake()
    {
        pathfinding       = GetComponent <EnemyPathfinding>();
        pathfinding.enemy = enemy;
        rb        = GetComponent <Rigidbody2D>();
        hpDisplay = transform.Find("HpDisplay");

        maxHp             = Mathf.RoundToInt(enemy.maxHp * DifficultyManager.difficulty);
        hp                = maxHp;
        rb.mass           = (enemy.maxHp + enemy.defense * 2) / 10;
        pathfinding.speed = speedMultiplier * enemy.speed;
    }
Exemplo n.º 7
0
    void Awake()
    {
        mAnim           = GetComponentInChildren <Animator> ();
        sr              = GetComponentInChildren <SpriteRenderer> ();
        audioManager    = GetComponentInChildren <AudioManager> ();
        mBody           = GetComponent <Rigidbody2D> ();
        pathfinding     = GetComponent <EnemyPathfinding> ();
        particleSystems = GetComponentsInChildren <ParticleSystem> ();

        pathfinding.seeker = gameObject.transform;
        StartCoroutine(PathRoutine());
    }
Exemplo n.º 8
0
 //OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     rb2d     = animator.GetComponent <Rigidbody2D>();
     pathfind = animator.GetComponent <EnemyPathfinding>();
     AI       = animator.GetComponent <EnemyAI>();
     AI.SetState(EnemyAIState.flyforward);
     emanager = animator.GetComponent <EnemyManager>();
     //pos = rb2d.position;
     pos  = rb2d.transform.right;
     axis = rb2d.transform.up;
     //player = pathfind.GetTargetTransform();
 }
Exemplo n.º 9
0
 protected virtual void Start()
 {
     playerHealth     = GameObject.FindWithTag("Player").GetComponent <Health>();
     enemyPathfinding = this.GetComponent <EnemyPathfinding>();
 }
Exemplo n.º 10
0
    //bool isProcessingPath;

    private void Awake()
    {
        instance    = this;
        pathfinding = GetComponent <EnemyPathfinding>();
    }
Exemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     nHitTime         = hitTime;
     enemyPathFinding = FindObjectOfType <EnemyPathfinding> ();
     player           = GameObject.FindGameObjectWithTag("Player");
 }
Exemplo n.º 12
0
 void Start()
 {
     pathfinding     = FindObjectOfType <EnemyPathfinding>();
     newTargetNumber = 0;
     EnemySelector   = 0;
 }
Exemplo n.º 13
0
 public void RemoveEnemyToList(EnemyPathfinding enemy)
 {
     enemies.Remove(enemy);
 }
Exemplo n.º 14
0
 public void AddEnemyToList(EnemyPathfinding enemy)
 {
     enemies.Add(enemy);
 }