grass eaten state

master
Jordan Orelli 5 years ago
parent 973ce3ef7e
commit d5116e0ef3

Binary file not shown.

Binary file not shown.

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 92e1aa06c8c3cab4ea96af6738f4ef52
ModelImporter:
serializedVersion: 19300
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 1
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 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
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
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
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

@ -13,6 +13,7 @@ GameObject:
- component: {fileID: 3145259671590046870} - component: {fileID: 3145259671590046870}
- component: {fileID: 9136160893208226110} - component: {fileID: 9136160893208226110}
- component: {fileID: 815455091500221479} - component: {fileID: 815455091500221479}
- component: {fileID: 2058777641646934996}
m_Layer: 0 m_Layer: 0
m_Name: grass m_Name: grass
m_TagString: Untagged m_TagString: Untagged
@ -119,3 +120,29 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 86848c7dd648f6c4aa0f53b506d13a0d, type: 3} m_Script: {fileID: 11500000, guid: 86848c7dd648f6c4aa0f53b506d13a0d, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
isEaten: 0
uneatenMesh: {fileID: 8254687373856176130, guid: a13ea5fe58adbd442985df8e71d11107,
type: 3}
eatenMesh: {fileID: 6081153864048940075, guid: 92e1aa06c8c3cab4ea96af6738f4ef52,
type: 3}
--- !u!50 &2058777641646934996
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3718534089451419722}
m_BodyType: 1
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 7

File diff suppressed because it is too large Load Diff

@ -2,21 +2,30 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class Grass : MonoBehaviour public class Grass : MonoBehaviour {
{ public bool isEaten;
public Mesh uneatenMesh;
public Mesh eatenMesh;
private MeshFilter meshFilter;
// Start is called before the first frame update // Start is called before the first frame update
void Start() { void Start() {
meshFilter = GetComponent<MeshFilter>();
} }
// Update is called once per frame // Update is called once per frame
void Update() { void Update() {
if (isEaten) {
meshFilter.mesh = eatenMesh;
} else {
meshFilter.mesh = uneatenMesh;
}
} }
void OnTriggerEnter2D(Collider2D collider) { void OnTriggerEnter2D(Collider2D collider) {
if (collider.CompareTag("Player")) { if (collider.CompareTag("Player") || collider.CompareTag("Enemy")) {
Destroy(gameObject); isEaten = true;
} }
} }
} }

Binary file not shown.
Loading…
Cancel
Save