we've got shooting spikes now

master
Jordan Orelli 5 years ago
parent c77633df79
commit c2f781d3f0

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 86097964f732a07459a77caee5ba662f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 051448788a55ef64e977dad7a56498b1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,97 @@
fileFormatVersion: 2
guid: b3610ba9ae1233b41904181ee3b4b7f8
ModelImporter:
serializedVersion: 23
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2100000: Material
2300000: //RootNode
3300000: //RootNode
4300000: shell
externalObjects: {}
materials:
importMaterials: 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: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
previousCalculatedGlobalScale: 1
hasPreviousCalculatedGlobalScale: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
importAnimation: 1
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 315d359da5d85f74382bed14abc5b4a8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,141 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4386614957785354166
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7872346393727921894}
- component: {fileID: 5044592589782728746}
- component: {fileID: 4862135574653546332}
m_Layer: 0
m_Name: ShootingSpike
m_TagString: Fatal
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7872346393727921894
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4386614957785354166}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_Children:
- {fileID: 4533833736885862285}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &5044592589782728746
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4386614957785354166}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9233be87a331d7c40ac203239227bacc, type: 3}
m_Name:
m_EditorClassIdentifier:
collisionMask:
serializedVersion: 2
m_Bits: 3072
acceleration: 25
maxSpeed: 12.5
--- !u!64 &4862135574653546332
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4386614957785354166}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 3
m_Convex: 1
m_CookingOptions: 14
m_Mesh: {fileID: 4300000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
--- !u!1001 &4533833736885986573
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 7872346393727921894}
m_Modifications:
- target: {fileID: 100000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_Name
value: spike
objectReference: {fileID: 0}
- target: {fileID: 100000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2300000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: c59c38011cbba7149b7be122430b0621, type: 2}
- target: {fileID: 2300000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9aced54bab99cb6499f16b696076404a, type: 3}
--- !u!4 &4533833736885862285 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 400000, guid: 9aced54bab99cb6499f16b696076404a,
type: 3}
m_PrefabInstance: {fileID: 4533833736885986573}
m_PrefabAsset: {fileID: 0}

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 006057916c23f8d489785fd6e0d2323a
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 181358029abbeb0489ee2b9d97810a2d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -16,7 +16,7 @@ public class CameraController : MonoBehaviour {
networking.CheckForMessages();
if (player) {
transform.position = new Vector3(player.position.x-1, player.position.y+4, player.position.z-8);
transform.position = new Vector3(player.position.x-2, player.position.y+2, player.position.z-10);
transform.LookAt(player);
}
}

@ -0,0 +1,70 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ShootingSpike : MonoBehaviour {
public float range = 20f;
public LayerMask collisionMask;
public float acceleration = 25f;
public float maxSpeed = 12.5f;
private Collider hitCollider;
private Vector3 triggerRayOrigin;
private Vector3 triggerRayDirection;
private float speed;
private Vector3 moveDirection;
private bool isMoving;
// Start is called before the first frame update
void Start() {
isMoving = false;
hitCollider = GetComponent<MeshCollider>();
}
// Update is called once per frame
void Update() {
if (isMoving) {
speed += acceleration * Time.deltaTime;
if (speed > maxSpeed) {
speed = maxSpeed;
}
Vector3 hitRayOrigin = transform.position + transform.up * transform.localScale.y;
Vector3 hitRayDirection = transform.TransformDirection(0, 1, 0);
RaycastHit hit;
if (Physics.Raycast(hitRayOrigin, hitRayDirection, out hit, speed * Time.deltaTime, collisionMask)) {
if (hit.collider.gameObject.layer == 11) {
Destroy(gameObject);
return;
}
} else {
Debug.DrawRay(hitRayOrigin, hitRayDirection * speed * Time.deltaTime, Color.green);
}
transform.position += moveDirection * speed * Time.deltaTime;
}
if (!isMoving) {
triggerRayOrigin = transform.position + transform.up * transform.localScale.y;
triggerRayDirection = transform.TransformDirection(0, 1, 0);
RaycastHit hit;
if (Physics.Raycast(triggerRayOrigin, triggerRayDirection, out hit, range, collisionMask)) {
if (hit.collider.gameObject.layer == 11) {
Debug.DrawRay(triggerRayOrigin, triggerRayDirection * hit.distance, Color.green);
}
if (hit.collider.gameObject.layer == 10) {
Debug.DrawRay(triggerRayOrigin, triggerRayDirection * hit.distance, Color.red);
isMoving = true;
moveDirection = triggerRayDirection;
}
} else {
Debug.DrawRay(triggerRayOrigin, triggerRayDirection * range, Color.green);
}
}
}
void OnTriggerEnter(Collider other) {
Debug.LogFormat("Falling spike collided with other: {0}", other);
}
}

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

Binary file not shown.
Loading…
Cancel
Save