Add Unity materials and prefabs for game objects for SOLID
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using Solid.Interfaces;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Solid
|
||||
{
|
||||
public class BulletShooter : MonoBehaviour, IShooter
|
||||
{
|
||||
[SerializeField] private Transform _shootSpawn;
|
||||
[SerializeField] private Rigidbody _projectilePrefab;
|
||||
[SerializeField] private float _shootForce = 10.0f;
|
||||
|
||||
public void Fire()
|
||||
{
|
||||
Rigidbody projectile = Instantiate(_projectilePrefab, _shootSpawn.position, _shootSpawn.rotation);
|
||||
projectile.AddForce(_shootSpawn.forward * _shootForce, ForceMode.Impulse);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d159adaa7cac4a7981971ad8f8bf61dd
|
||||
timeCreated: 1774972320
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Solid.Interfaces
|
||||
{
|
||||
public interface IShooter
|
||||
{
|
||||
void Fire();
|
||||
|
||||
// BAD IDEA => segregate interfaces
|
||||
// void ApplyEffect();
|
||||
// void Explode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50a37d913948492fa7a36ccd491319a3
|
||||
timeCreated: 1774972093
|
||||
Reference in New Issue
Block a user