Refactoring Prefabs

This commit is contained in:
pbg2h23akl 2024-06-14 16:58:09 +02:00
parent 6bd36f657f
commit 781ca8706a
13 changed files with 417 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,114 @@
fileFormatVersion: 2
guid: 0797a6563c6efce43878294d5e8c8223
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: b9bfba4548a66f142aef785aaad262eb
ModelImporter:
serializedVersion: 22200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -87,7 +87,7 @@ Transform:
m_GameObject: {fileID: 1549001692297207422}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0.1, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -106,7 +106,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
parent: {fileID: 939049122039926632}
dataBullet: {fileID: 11400000, guid: 215ad7d91b06f2741b40dc3806033238, type: 2}
dataBullet: {fileID: 11400000, guid: cafd241bae342f446ae8141cc5d72daf, type: 2}
rb: {fileID: 0}
--- !u!1 &4152829191026619603
GameObject:

View File

@ -123,6 +123,63 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1001 &571304931
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: b9bfba4548a66f142aef785aaad262eb, type: 3}
propertyPath: m_LocalPosition.x
value: 6.427336
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b9bfba4548a66f142aef785aaad262eb, type: 3}
propertyPath: m_LocalPosition.y
value: 2.4611318
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b9bfba4548a66f142aef785aaad262eb, type: 3}
propertyPath: m_LocalPosition.z
value: -6.166448
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b9bfba4548a66f142aef785aaad262eb, type: 3}
propertyPath: m_LocalRotation.w
value: -0.31750855
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b9bfba4548a66f142aef785aaad262eb, type: 3}
propertyPath: m_LocalRotation.x
value: -0.09981125
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b9bfba4548a66f142aef785aaad262eb, type: 3}
propertyPath: m_LocalRotation.y
value: 0.94145095
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b9bfba4548a66f142aef785aaad262eb, type: 3}
propertyPath: m_LocalRotation.z
value: -0.053816654
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b9bfba4548a66f142aef785aaad262eb, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 9.481
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b9bfba4548a66f142aef785aaad262eb, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 216.529
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b9bfba4548a66f142aef785aaad262eb, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: -8.968
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: b9bfba4548a66f142aef785aaad262eb, type: 3}
propertyPath: m_Name
value: spider2
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b9bfba4548a66f142aef785aaad262eb, type: 3}
--- !u!1 &679648469
GameObject:
m_ObjectHideFlags: 0
@ -1005,3 +1062,4 @@ SceneRoots:
- {fileID: 1843618955}
- {fileID: 1644435821}
- {fileID: 1706923861}
- {fileID: 571304931}

View File

@ -136,7 +136,7 @@ GameObject:
- component: {fileID: 430367787}
- component: {fileID: 430367786}
m_Layer: 0
m_Name: Gun
m_Name: GunMesh
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -221,13 +221,59 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 430367785}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.789454, y: 2.4244237, z: -9.61718}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_Father: {fileID: 1840023902}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1380387582
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1380387583}
- component: {fileID: 1380387584}
m_Layer: 0
m_Name: WeaponScript
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1380387583
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1380387582}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.5, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1840023902}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1380387584
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1380387582}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f0262bbe3025ed14984b9ca540206237, type: 3}
m_Name:
m_EditorClassIdentifier:
parent: {fileID: 1840023901}
bullet: {fileID: 939049122039926632, guid: 5bd04146a95212e41bc2c52b7079e131, type: 3}
--- !u!1 &1827603663
GameObject:
m_ObjectHideFlags: 0
@ -322,6 +368,39 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1840023901
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1840023902}
m_Layer: 0
m_Name: Gun
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1840023902
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1840023901}
serializedVersion: 2
m_LocalRotation: {x: -0, y: 0.26252207, z: -0, w: 0.96492606}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 430367789}
- {fileID: 1380387583}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 30.44, z: 0}
--- !u!1 &2061567904
GameObject:
m_ObjectHideFlags: 0
@ -428,7 +507,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3286218375903244322, guid: 5bd04146a95212e41bc2c52b7079e131, type: 3}
propertyPath: m_LocalPosition.x
value: 0
value: 0.74
objectReference: {fileID: 0}
- target: {fileID: 3286218375903244322, guid: 5bd04146a95212e41bc2c52b7079e131, type: 3}
propertyPath: m_LocalPosition.y
@ -477,5 +556,5 @@ SceneRoots:
m_Roots:
- {fileID: 2061567907}
- {fileID: 1827603665}
- {fileID: 430367789}
- {fileID: 3184073952171808938}
- {fileID: 1840023902}

View File

@ -10,16 +10,20 @@ public class BulletMoving : MonoBehaviour
[SerializeField]
private Rigidbody rb;
private Vector3 direction = new Vector3(0f,0f,0f);
private
// Start is called before the first frame update
void Start()
{
rb = parent.GetComponent<Rigidbody>();
direction = transform.position - parent.transform.position;
}
// Update is called once per frame
void Update()
{
rb.velocity = dataBullet.direction * dataBullet.speed;
rb.velocity = direction * dataBullet.speed;
}
}

View File

@ -10,8 +10,6 @@ public class DataBullet : ScriptableObject
public float speed = 5f;
public Vector3 direction = new Vector3();
public int ammo;
public void setDamage(float damage){

View File

@ -10,9 +10,8 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9e1d27c11e7949e4fa59cefee3928ca4, type: 3}
m_Name: BulletData1
m_Name: DataBullet
m_EditorClassIdentifier:
damage: 10
speed: 2
direction: {x: 1, y: 0, z: 0}
speed: 10
ammo: 4

View File

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

View File

@ -0,0 +1,30 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WeaponScript : MonoBehaviour
{
public GameObject parent;
public GameObject bullet;
public void shoot(){
if(Input.GetKeyDown(KeyCode.Mouse0)){
Instantiate(bullet,transform.position,parent.transform.rotation);
}
}
void Start()
{
}
// Update is called once per frame
void Update()
{
shoot();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f0262bbe3025ed14984b9ca540206237
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: