Ejemplo n.º 1
0
 void Awake()
 {
     _anim = GetComponent <Animator>();
     _move = GetComponent <AIMovementComp>();
     _aim  = GetComponent <AITargetComp>();
     Initialized();
 }
Ejemplo n.º 2
0
    public void DoAttack()
    {
        if (!_move)
        {
            _move = GetComponent <AIMovementComp>();
        }

        Vector2 castDir = _move.GetVectorDirection();

        RaycastHit2D[] hits = Physics2D.BoxCastAll(transform.position, new Vector2(1.2f, 1.2f), 0f, castDir, 2f);

        for (int i = 0; i < hits.Length; i++)
        {
            if (hits[i].transform.CompareTag("Player"))
            {
                hits[i].transform.GetComponent <GayatriCharacter>().ApplyDamage(attackDamage, this.gameObject);
                break;
            }
        }

        if (Task.isInspected)
        {
            Task.current.Succeed();
        }
    }
Ejemplo n.º 3
0
 void Awake()
 {
     _move = GetComponent <AIMovementComp>();
     _anim = GetComponent <Animator>();
     Initialized();
     _healthSlider = healthCanvas.GetComponentInChildren <Slider>();
 }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        _movementComp = GetComponent <AIMovementComp>();
        _boxColl2D    = GetComponent <BoxCollider2D>();

        //TODO nanti ganti
        _movementComp.SetPlayerAsTarget();
        Initialized();
    }
Ejemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     _movementComp = GetComponent <AIMovementComp>();
     _targetComp   = GetComponent <AITargetComp>();
 }
Ejemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     _movementComp = GetComponent <AIMovementComp>();
     CalcFireRate();
     SelectPrefab(0);
 }