public override void OnFire(Stats playerStats) { if (playerStats.manna > 0) { GameObject newBarrier = Instantiate(Barrier); playerStats.manna -= 20; FireAttack?.Invoke(); Destroy(newBarrier.gameObject, 5); } }
public override void OnFire(Stats playerStats) { if (BaseDamageLevel == 0) { BaseDamageLevel = playerStats.Damage; stats = playerStats; } playerStats.Damage = BaseDamageLevel + ExtraDamage; playerStats.manna--; FireAttack?.Invoke(); }
public override void OnFire(Stats playerstats) { if (MaxTurretsCount > countOfSpawned) { GameObject newTurret = Instantiate(TurretPrefab); newTurret.transform.position = TurretMask.transform.position; newTurret.GetComponent <TurretScript>().OnTurretDestroyed.AddListener(() => countOfSpawned--); // newTurret.transform.localScale = Vector3.one; countOfSpawned++; FireAttack?.Invoke(); } }
public override void OnFire(Stats playerStats) { if (stats.manna > 0) { Vector3 direction = crossHair.position - transform.position; transform.right = direction; SkillAnimation.Play("SkillAnimation"); timeShot = 2; stats.manna -= mannaMinus; FireAttack?.Invoke(); } }
public override void OnFire(Stats playerStats) { Debug.Log("fire"); if (CurrentWeapon != null) { Debug.Log("fire2"); if (timeShot <= 0) { Debug.Log("fire3"); if (GetComponentInParent <Inventory>().Ammo > 0) { Debug.Log("fire"); Vector3 direction = shotDir.right; GameObject bullet = Instantiate(CurrentWeapon.ammo, shotDir.position, transform.rotation); //Debug.Log(bullet.transform.position +" "+shotDir.position); Vector3 pos = bullet.transform.position; pos.z = 0; bullet.transform.position = pos; bullet.GetComponent <BulletScipt>().TargetTag = "Enemy"; bullet.GetComponent <BulletScipt>().Damage = CurrentWeapon.Damage + (int)playerStats.Damage; if (transform.parent.localScale.x > 0) { bullet.GetComponent <Rigidbody2D>().AddForce(direction * CurrentWeapon.Force);// затем прикладываем к компоненту Rigidbody2D выктор силы: вправо от объекта Shooter с силой shootForce } else { bullet.GetComponent <Rigidbody2D>().AddForce(-1 * direction * CurrentWeapon.Force); // затем прикладываем к компоненту Rigidbody2D выктор силы: вправо от объекта Shooter с силой shootForce } Destroy(bullet.gameObject, CurrentWeapon.BulletDestroyTime); // уничтожаем копию пули с задержкой timeShot = CurrentWeapon.CoolDown; GetComponentInParent <Inventory>().Ammo--; FireAttack?.Invoke(); } } } }