void Awake() { _anim = GetComponent <Animator>(); _move = GetComponent <AIMovementComp>(); _aim = GetComponent <AITargetComp>(); Initialized(); }
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(); } }
void Awake() { _move = GetComponent <AIMovementComp>(); _anim = GetComponent <Animator>(); Initialized(); _healthSlider = healthCanvas.GetComponentInChildren <Slider>(); }
// Use this for initialization void Start() { _movementComp = GetComponent <AIMovementComp>(); _boxColl2D = GetComponent <BoxCollider2D>(); //TODO nanti ganti _movementComp.SetPlayerAsTarget(); Initialized(); }
// Use this for initialization void Start() { _movementComp = GetComponent <AIMovementComp>(); _targetComp = GetComponent <AITargetComp>(); }
// Use this for initialization void Start() { _movementComp = GetComponent <AIMovementComp>(); CalcFireRate(); SelectPrefab(0); }