private void FixedUpdate() { if (collidedShield) { gameObject.layer = LayerMask.NameToLayer("BlownEnemy"); isBlown = true; var wallLayer = LayerMask.NameToLayer("Wall"); if (collisions.Contains(wallLayer)) { if (health > 0.0f) { ApplyDamage(); } } } else { isBlown = false; gameObject.layer = LayerMask.NameToLayer("Enemy"); } onFixedUpdated(); collidedShield = null; collisions.Clear(); }
private void OnCollisionStay(Collision collision) { collisions.Add(collision.gameObject.layer); if (IsRadiateShield(collision.gameObject)) { collidedShield = collision.gameObject.GetComponent <ShieldCore>(); } }
void ShotReady() { if (Input.GetMouseButtonDown(0) && _core.energySystem.energy >= _shotCost) { _holdedShield = Instantiate(_shieldPrefab); _holdedShield.transform.position = transform.position + transform.forward * _distance + transform.up * _height; _shieldCore = _holdedShield.GetComponent <ShieldCore>(); _shieldCore.destroySystem.isLock = true; _shieldCore.movementSystem.isLock = true; _isHolding = true; _core.energySystem.energy -= _shotCost; _state = Hold; _core.movementSystem.dashLock = true; _core.energySystem.isLock = true; } }
private void Awake() { _core = GetComponent <ShieldCore>(); transform.localScale = new Vector3(_minScale, transform.localScale.y, transform.localScale.z); }