void Update() { if (mCurrentWeapon != null) { mTime += Time.deltaTime; if (mTime >= mCurrentWeapon._CoolDownTime) { mTime = 0.0f; Vector3 startPos = mMovement.transform.position; startPos.y -= 0.6f; mCurrentWeapon.Fire(startPos); } } CharacterLevelInfo currentLevel = _LevelInfo [mShooter.CurrentLevel() - 1]; Vector3 newPos = transform.position; newPos.y -= (currentLevel._Speed * Time.deltaTime); transform.position = newPos; if (IsOutsideBottomScreen(newPos)) { PoolManager.AddObject(_PoolKeyName, gameObject); } }
void OnTriggerEnter(Collider other) { if (other.gameObject.layer == LayerMask.NameToLayer(_BulletMaskName)) { Bullet bullet = other.gameObject.GetComponent <Bullet>(); PoolManager.AddObject(bullet._Weapon._BulletName, bullet.gameObject); mCurrentDamage += bullet._Weapon._Damage; CharacterLevelInfo levelInfo = _LevelInfo[mShooter.CurrentLevel() - 1]; if (mCurrentDamage >= levelInfo._MaxDamage) { mShooter.LostLife(); mCurrentDamage = 0; } } }