public PlayerShip(IView view, IShieldView shieldView, IInputReader inputReader) { var movementSettings = Resources.Load <MovementSettings>("Settings/PlayerShip"); Ship = new Ship(view, new Gun(ProjectileType.PlayerBullet), movementSettings); Ship.Projectile.Type = ProjectileType.PlayerShip; this.shieldView = shieldView; this.view = view; inputReader.OnInput += OnInput; shieldView.OnCollision += OnCollision; this.view.OnUpdate += OnUpdate; this.view.Position = Ship.Projectile.Movement.Position; this.view.Active = true; }
private void OnTriggerEnter(Collider other) { if (Shield) { return; } IShieldView shield = other.GetComponent <IShieldView>(); if (shield != null && shield.Shield) { return; } OnCollision(this, new CollisionEventArgs(other, other.GetComponent <IView>().Type)); }