Refactor Names // Prefab Bullet erstellt

This commit is contained in:
pbg2h23akl
2024-06-14 10:35:34 +02:00
parent f831f7e310
commit 1b7f7c88bc
7 changed files with 191 additions and 248 deletions

View File

@@ -6,9 +6,9 @@ public class BulletMoving : MonoBehaviour
{
public GameObject parent;
public BulletScript bulletScript;
public Rigidbody rb;
public DataBullet dataBullet;
[SerializeField]
private Rigidbody rb;
private
// Start is called before the first frame update
@@ -20,6 +20,6 @@ public class BulletMoving : MonoBehaviour
// Update is called once per frame
void Update()
{
rb.velocity = bulletScript.direction * bulletScript.speed;
rb.velocity = dataBullet.direction * dataBullet.speed;
}
}

View File

@@ -4,13 +4,17 @@ using UnityEditor;
using UnityEngine;
[CreateAssetMenu(fileName = "BulletScriptableObject", menuName = "BulletScriptableObject", order = 0)]
public class BulletScript : ScriptableObject
public class DataBullet : ScriptableObject
{
public int damage = 10;
public float damage = 10;
public float speed = 5f;
public Vector3 direction = new Vector3();
public int ammo;
public void setDamage(float damage){
this.damage = damage;
}
}

View File

@@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9e1d27c11e7949e4fa59cefee3928ca4, type: 3}
m_Name: BulletScriptableObject
m_Name: BulletData1
m_EditorClassIdentifier:
damage: 10
speed: 2

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4a62dca8041fc5c48944492b0df9ef56
guid: 215ad7d91b06f2741b40dc3806033238
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000