/// <summary> /// Start is called on the frame when a script is enabled just before /// any of the Update methods is called the first time. /// </summary> void Start() { _droneAgent = GetComponent <NavMeshAgent>(); _droneAttack = GetComponent <DroneAttack>(); _player = GameObject.FindGameObjectWithTag(TagManager.Player)?.transform; _droneAnimator = GetComponent <Animator>(); _droneAttacking = false; }
public override void Atk(Transform barrel, AudioManager AM, bool isPlayer) { Vector2 barrelV = new Vector2(barrel.position.x, barrel.position.y); GameObject bullet = Instantiate(bulletPrefab, barrelV, barrel.rotation); Rigidbody2D rb = bullet.GetComponent <Rigidbody2D>(); MachineBullet MB = bullet.GetComponent <MachineBullet>(); DroneAttack DA = bullet.GetComponent <DroneAttack>(); DA.isPlayer = isPlayer; MB.damage = damage; MB.range = range; MB.isPlayer = isPlayer; }
void Start() { _GM_ = GameObject.FindGameObjectWithTag("GM").GetComponent <GM>(); player = _GM_.player; rb = GetComponent <Rigidbody2D>(); if (droneType == 1) { attackScript = GetComponent <DroneAttack>(); } else { attackScript2 = GetComponent <Drone2Attack>(); } anim = GetComponent <DroneAnimation>(); }
public void SetDroneAttack(DroneAttack droneAttack) { DroneAttack = droneAttack; }