Add push pull power
This commit is contained in:
parent
849b105eee
commit
dd17bac1d9
79
Assets/Materials/PushPull.mat
Normal file
79
Assets/Materials/PushPull.mat
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: PushPull
|
||||||
|
m_Shader: {fileID: 4800000, guid: bf662471a11144e48aefe2569a560ec9, type: 3}
|
||||||
|
m_ShaderKeywords:
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: -1
|
||||||
|
stringTagMap: {}
|
||||||
|
disabledShaderPasses: []
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- _BumpMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailAlbedoMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailMask:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailNormalMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _EmissionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MainTex:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MetallicGlossMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _OcclusionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _ParallaxMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Floats:
|
||||||
|
- _BumpScale: 1
|
||||||
|
- _Cutoff: 0.5
|
||||||
|
- _DetailNormalMapScale: 1
|
||||||
|
- _DstBlend: 0
|
||||||
|
- _GlossMapScale: 1
|
||||||
|
- _Glossiness: 0.5
|
||||||
|
- _GlossyReflections: 1
|
||||||
|
- _Metallic: 0
|
||||||
|
- _Mode: 0
|
||||||
|
- _OcclusionStrength: 1
|
||||||
|
- _Outline: 0.25
|
||||||
|
- _Parallax: 0.02
|
||||||
|
- _SmoothnessTextureChannel: 0
|
||||||
|
- _SpecularHighlights: 1
|
||||||
|
- _SrcBlend: 1
|
||||||
|
- _UVSec: 0
|
||||||
|
- _ZWrite: 1
|
||||||
|
m_Colors:
|
||||||
|
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
- _OutlineColor: {r: 0.5568628, g: 0.37853974, b: 0.11764706, a: 1}
|
8
Assets/Materials/PushPull.mat.meta
Normal file
8
Assets/Materials/PushPull.mat.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 49025a60961b95a43986697748175308
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
127
Assets/Prefabs/PushPullCube.prefab
Normal file
127
Assets/Prefabs/PushPullCube.prefab
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &7120608647080996497
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 7120608647080996506}
|
||||||
|
- component: {fileID: 7120608647080996501}
|
||||||
|
- component: {fileID: 7120608647080996500}
|
||||||
|
- component: {fileID: 7120608647080996503}
|
||||||
|
- component: {fileID: 7120608647080996502}
|
||||||
|
- component: {fileID: 7120608647080996507}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PushPullCube
|
||||||
|
m_TagString: Objects
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &7120608647080996506
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7120608647080996497}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 4.67, y: 0.76, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!33 &7120608647080996501
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7120608647080996497}
|
||||||
|
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!23 &7120608647080996500
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7120608647080996497}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
- {fileID: 2100000, guid: 49025a60961b95a43986697748175308, type: 2}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!65 &7120608647080996503
|
||||||
|
BoxCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7120608647080996497}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Size: {x: 1, y: 1, z: 1}
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!54 &7120608647080996502
|
||||||
|
Rigidbody:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7120608647080996497}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Mass: 70
|
||||||
|
m_Drag: 0
|
||||||
|
m_AngularDrag: 0.05
|
||||||
|
m_UseGravity: 1
|
||||||
|
m_IsKinematic: 0
|
||||||
|
m_Interpolate: 0
|
||||||
|
m_Constraints: 120
|
||||||
|
m_CollisionDetection: 0
|
||||||
|
--- !u!114 &7120608647080996507
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7120608647080996497}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: c7be605e9d134b742b0269485b577d6a, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
objectType: 1
|
7
Assets/Prefabs/PushPullCube.prefab.meta
Normal file
7
Assets/Prefabs/PushPullCube.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 597897b562955934fae65d62e0a8e3cd
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -306,75 +306,6 @@ Transform:
|
|||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||||
--- !u!1001 &4696517446902494616
|
|
||||||
PrefabInstance:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Modification:
|
|
||||||
m_TransformParent: {fileID: 0}
|
|
||||||
m_Modifications:
|
|
||||||
- target: {fileID: 8426673075699058389, guid: a81c7869040fbef4f8d5acf2c1499c42,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: m_Name
|
|
||||||
value: SkillCube
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 9203772316689128559, guid: a81c7869040fbef4f8d5acf2c1499c42,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: m_RootOrder
|
|
||||||
value: 3
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 9203772316689128559, guid: a81c7869040fbef4f8d5acf2c1499c42,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalPosition.x
|
|
||||||
value: 5.38
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 9203772316689128559, guid: a81c7869040fbef4f8d5acf2c1499c42,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalPosition.y
|
|
||||||
value: 0.66
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 9203772316689128559, guid: a81c7869040fbef4f8d5acf2c1499c42,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalPosition.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 9203772316689128559, guid: a81c7869040fbef4f8d5acf2c1499c42,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalRotation.w
|
|
||||||
value: 1
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 9203772316689128559, guid: a81c7869040fbef4f8d5acf2c1499c42,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalRotation.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 9203772316689128559, guid: a81c7869040fbef4f8d5acf2c1499c42,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalRotation.y
|
|
||||||
value: -0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 9203772316689128559, guid: a81c7869040fbef4f8d5acf2c1499c42,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalRotation.z
|
|
||||||
value: -0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 9203772316689128559, guid: a81c7869040fbef4f8d5acf2c1499c42,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 9203772316689128559, guid: a81c7869040fbef4f8d5acf2c1499c42,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 9203772316689128559, guid: a81c7869040fbef4f8d5acf2c1499c42,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
m_RemovedComponents: []
|
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: a81c7869040fbef4f8d5acf2c1499c42, type: 3}
|
|
||||||
--- !u!1001 &6840056971477016067
|
--- !u!1001 &6840056971477016067
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -387,6 +318,16 @@ PrefabInstance:
|
|||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: Player
|
value: Player
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7094923891560833916, guid: e4d82994b58b7304b91c915c597b71f8,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: activeAbility.Array.size
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7094923891560833916, guid: e4d82994b58b7304b91c915c597b71f8,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: activeAbility.Array.data[0]
|
||||||
|
value: 3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7094923891560833917, guid: e4d82994b58b7304b91c915c597b71f8,
|
- target: {fileID: 7094923891560833917, guid: e4d82994b58b7304b91c915c597b71f8,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
@ -454,7 +395,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 8125994354137083922, guid: 0d7691d0b9091aa4dba16f262d8daf1b,
|
- target: {fileID: 8125994354137083922, guid: 0d7691d0b9091aa4dba16f262d8daf1b,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 4
|
value: 3
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8125994354137083922, guid: 0d7691d0b9091aa4dba16f262d8daf1b,
|
- target: {fileID: 8125994354137083922, guid: 0d7691d0b9091aa4dba16f262d8daf1b,
|
||||||
type: 3}
|
type: 3}
|
||||||
@ -511,5 +452,10 @@ PrefabInstance:
|
|||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: PPV
|
value: PPV
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8125994354137083925, guid: 0d7691d0b9091aa4dba16f262d8daf1b,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: isGlobal
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 0d7691d0b9091aa4dba16f262d8daf1b, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 0d7691d0b9091aa4dba16f262d8daf1b, type: 3}
|
||||||
|
@ -4,20 +4,83 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class ObjectManager : MonoBehaviour
|
public class ObjectManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
public enum ObjectType {Nothing, Door, PushPull, Drag, Ladder};
|
public enum ObjectType {Nothing, PushPull, Drag};
|
||||||
public ObjectType objectType = ObjectType.Nothing;
|
public ObjectType objectType = ObjectType.Nothing;
|
||||||
private Rigidbody rigidBody;
|
private Rigidbody rigidBody;
|
||||||
|
private MeshRenderer meshRenderer;
|
||||||
|
private PlayerManager playerManager;
|
||||||
|
private bool interact = false;
|
||||||
|
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
meshRenderer = GetComponent<MeshRenderer>();
|
||||||
|
meshRenderer.materials[1].SetFloat ("_Outline", 0.0f);
|
||||||
|
meshRenderer.materials[1].SetColor("_OutlineColor", new Color(0.5276349f, 0.5566038f, 0.118147f));
|
||||||
rigidBody = GetComponent<Rigidbody>();
|
rigidBody = GetComponent<Rigidbody>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
if (interact)
|
||||||
|
{
|
||||||
|
if (objectType == ObjectType.PushPull)
|
||||||
|
{
|
||||||
|
if (Input.GetKeyUp(KeyCode.E))
|
||||||
|
{
|
||||||
|
if (playerManager.GetPushPullObject() == null)
|
||||||
|
{
|
||||||
|
playerManager.SetPushPullObject(this.gameObject);
|
||||||
|
meshRenderer.materials[1].SetColor("_OutlineColor", new Color(0.5568628f, 0.3785397f, 0.1176471f));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
playerManager.RemovePushPullObject();
|
||||||
|
meshRenderer.materials[1].SetColor("_OutlineColor", new Color(0.5276349f, 0.5566038f, 0.118147f));
|
||||||
|
playerManager = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (playerManager != null && playerManager.GetPushPullObject() == null)
|
||||||
|
{
|
||||||
|
meshRenderer.materials[1].SetColor("_OutlineColor", new Color(0.5276349f, 0.5566038f, 0.118147f));
|
||||||
|
}
|
||||||
|
if (Input.GetKeyUp(KeyCode.E))
|
||||||
|
{
|
||||||
|
if (playerManager != null)
|
||||||
|
{
|
||||||
|
playerManager.RemovePushPullObject();
|
||||||
|
playerManager = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCollisionStay(Collision collision)
|
||||||
|
{
|
||||||
|
if (collision.gameObject.tag == "Player")
|
||||||
|
{
|
||||||
|
Vector3 hit = collision.contacts[0].normal;
|
||||||
|
if (hit.x != 0 && hit.y == 0)
|
||||||
|
{
|
||||||
|
meshRenderer.materials[1].SetFloat("_Outline", 0.25f);
|
||||||
|
playerManager = collision.gameObject.GetComponent<PlayerManager>();
|
||||||
|
interact = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCollisionExit(Collision collision)
|
||||||
|
{
|
||||||
|
if (collision.gameObject.tag == "Player")
|
||||||
|
{
|
||||||
|
meshRenderer.materials[1].SetFloat("_Outline", 0.0f);
|
||||||
|
interact = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ public class PlayerManager : MonoBehaviour
|
|||||||
|
|
||||||
public List<int> activeAbility = new List<int>(); //without ability=0 or null, dubleJump = 1, push/pull = 2, dash = 3
|
public List<int> activeAbility = new List<int>(); //without ability=0 or null, dubleJump = 1, push/pull = 2, dash = 3
|
||||||
private bool dubleJump = true;
|
private bool dubleJump = true;
|
||||||
|
private GameObject pushPullObject;
|
||||||
|
|
||||||
private bool startEating = false;
|
private bool startEating = false;
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ public class PlayerManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
playerAnimator.Play("Die");
|
playerAnimator.Play("Die");
|
||||||
}
|
}
|
||||||
|
AbilityAction();
|
||||||
DeactivePowerCube();
|
DeactivePowerCube();
|
||||||
Move();
|
Move();
|
||||||
RunSwitch();
|
RunSwitch();
|
||||||
@ -72,6 +74,37 @@ public class PlayerManager : MonoBehaviour
|
|||||||
Jump();
|
Jump();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AbilityAction()
|
||||||
|
{
|
||||||
|
if (activeAbility.Count > 0 && activeAbility[0] == 2)
|
||||||
|
{
|
||||||
|
if (pushPullObject != null)
|
||||||
|
{
|
||||||
|
pushPullObject.GetComponent<Rigidbody>().MovePosition(
|
||||||
|
pushPullObject.transform.position +
|
||||||
|
(pushPullObject.transform.right * (run ? runSpeed : speed) * Input.GetAxis("Horizontal") * Time.deltaTime)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameObject GetPushPullObject()
|
||||||
|
{
|
||||||
|
return pushPullObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPushPullObject(GameObject objectPP)
|
||||||
|
{
|
||||||
|
if (activeAbility.Count > 0 && activeAbility[0] == 2) {
|
||||||
|
pushPullObject = objectPP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemovePushPullObject()
|
||||||
|
{
|
||||||
|
pushPullObject = null;
|
||||||
|
}
|
||||||
|
|
||||||
void RunSwitch()
|
void RunSwitch()
|
||||||
{
|
{
|
||||||
if (Input.GetAxisRaw("Run") > 0)
|
if (Input.GetAxisRaw("Run") > 0)
|
||||||
@ -95,21 +128,26 @@ public class PlayerManager : MonoBehaviour
|
|||||||
if (Input.GetAxis("Horizontal") > 0)
|
if (Input.GetAxis("Horizontal") > 0)
|
||||||
{
|
{
|
||||||
playerAnimator.SetBool("Walk", true);
|
playerAnimator.SetBool("Walk", true);
|
||||||
|
if (pushPullObject == null) {
|
||||||
playerAnimator.transform.rotation = Quaternion.Lerp(
|
playerAnimator.transform.rotation = Quaternion.Lerp(
|
||||||
playerAnimator.transform.rotation,
|
playerAnimator.transform.rotation,
|
||||||
Quaternion.Euler(playerAnimator.transform.eulerAngles.x, -90f, playerAnimator.transform.eulerAngles.z),
|
Quaternion.Euler(playerAnimator.transform.eulerAngles.x, -90f, playerAnimator.transform.eulerAngles.z),
|
||||||
localSpeed * Time.deltaTime
|
localSpeed * Time.deltaTime
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (Input.GetAxis("Horizontal") < 0)
|
else if (Input.GetAxis("Horizontal") < 0)
|
||||||
{
|
{
|
||||||
playerAnimator.SetBool("Walk", true);
|
playerAnimator.SetBool("Walk", true);
|
||||||
|
if (pushPullObject == null)
|
||||||
|
{
|
||||||
playerAnimator.transform.rotation = Quaternion.Lerp(
|
playerAnimator.transform.rotation = Quaternion.Lerp(
|
||||||
playerAnimator.transform.rotation,
|
playerAnimator.transform.rotation,
|
||||||
Quaternion.Euler(playerAnimator.transform.eulerAngles.x, 90f, playerAnimator.transform.eulerAngles.z),
|
Quaternion.Euler(playerAnimator.transform.eulerAngles.x, 90f, playerAnimator.transform.eulerAngles.z),
|
||||||
localSpeed * Time.deltaTime
|
localSpeed * Time.deltaTime
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
playerAnimator.SetBool("Walk", false);
|
playerAnimator.SetBool("Walk", false);
|
||||||
@ -132,6 +170,7 @@ public class PlayerManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (rigidBody.velocity.y <= 1 && (onGround || (dubleJump && activeAbility.Count > 0 && activeAbility[0] == 1)))
|
if (rigidBody.velocity.y <= 1 && (onGround || (dubleJump && activeAbility.Count > 0 && activeAbility[0] == 1)))
|
||||||
{
|
{
|
||||||
|
pushPullObject = null;
|
||||||
rigidBody.AddForce(
|
rigidBody.AddForce(
|
||||||
(transform.right * (run ? runSpeed : speed) * 5 * Input.GetAxis("Horizontal") * Time.deltaTime) +
|
(transform.right * (run ? runSpeed : speed) * 5 * Input.GetAxis("Horizontal") * Time.deltaTime) +
|
||||||
(transform.up * jump * 10 * Time.deltaTime),
|
(transform.up * jump * 10 * Time.deltaTime),
|
||||||
@ -243,10 +282,11 @@ public class PlayerManager : MonoBehaviour
|
|||||||
|
|
||||||
public void OnCollisionEnter(Collision collision)
|
public void OnCollisionEnter(Collision collision)
|
||||||
{
|
{
|
||||||
if (collision.gameObject.tag == "Objects")
|
if (collision.gameObject.GetComponent<PowerCubeManager>() != null)
|
||||||
{
|
{
|
||||||
Vector3 hit = collision.contacts[0].normal;
|
Vector3 hit = collision.contacts[0].normal;
|
||||||
if (hit.x != 0) {
|
if (hit.x != 0 && hit.y == 0)
|
||||||
|
{
|
||||||
powerCubeManager = collision.gameObject.GetComponent<PowerCubeManager>();
|
powerCubeManager = collision.gameObject.GetComponent<PowerCubeManager>();
|
||||||
playerAnimator.SetTrigger("Eat");
|
playerAnimator.SetTrigger("Eat");
|
||||||
}
|
}
|
||||||
|
8
Assets/Shaders.meta
Normal file
8
Assets/Shaders.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f3cc6d9e22086d443b811d2ec2c3d46c
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
82
Assets/Shaders/Border.shader
Normal file
82
Assets/Shaders/Border.shader
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
Shader "Outlined/Silhouette Only"
|
||||||
|
{
|
||||||
|
Properties{
|
||||||
|
_OutlineColor("Outline Color", Color) = (0,0,0,1)
|
||||||
|
_Outline("Outline width", Range(0.0, 1.0)) = .005
|
||||||
|
}
|
||||||
|
|
||||||
|
CGINCLUDE
|
||||||
|
#include "UnityCG.cginc"
|
||||||
|
|
||||||
|
struct appdata {
|
||||||
|
float4 vertex : POSITION;
|
||||||
|
float3 normal : NORMAL;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct v2f {
|
||||||
|
float4 pos : POSITION;
|
||||||
|
float4 color : COLOR;
|
||||||
|
};
|
||||||
|
|
||||||
|
uniform float _Outline;
|
||||||
|
uniform float4 _OutlineColor;
|
||||||
|
|
||||||
|
v2f vert(appdata v) {
|
||||||
|
// just make a copy of incoming vertex data but scaled according to normal direction
|
||||||
|
v2f o;
|
||||||
|
o.pos = UnityObjectToClipPos(v.vertex);
|
||||||
|
|
||||||
|
float3 norm = mul((float3x3)UNITY_MATRIX_IT_MV, v.normal);
|
||||||
|
float2 offset = TransformViewToProjection(norm.xy);
|
||||||
|
|
||||||
|
o.pos.xy += offset * o.pos.z * _Outline;
|
||||||
|
o.color = _OutlineColor;
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
ENDCG
|
||||||
|
|
||||||
|
SubShader{
|
||||||
|
Tags { "Queue" = "Transparent" }
|
||||||
|
|
||||||
|
Pass {
|
||||||
|
Name "BASE"
|
||||||
|
Cull Back
|
||||||
|
Blend Zero One
|
||||||
|
|
||||||
|
// uncomment this to hide inner details:
|
||||||
|
//Offset -8, -8
|
||||||
|
|
||||||
|
SetTexture[_OutlineColor] {
|
||||||
|
ConstantColor(0,0,0,0)
|
||||||
|
Combine constant
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// note that a vertex shader is specified here but it's using the one above
|
||||||
|
Pass {
|
||||||
|
Name "OUTLINE"
|
||||||
|
Tags { "LightMode" = "Always" }
|
||||||
|
Cull Front
|
||||||
|
|
||||||
|
// you can choose what kind of blending mode you want for the outline
|
||||||
|
//Blend SrcAlpha OneMinusSrcAlpha // Normal
|
||||||
|
//Blend One One // Additive
|
||||||
|
Blend One OneMinusDstColor // Soft Additive
|
||||||
|
//Blend DstColor Zero // Multiplicative
|
||||||
|
//Blend DstColor SrcColor // 2x Multiplicative
|
||||||
|
|
||||||
|
CGPROGRAM
|
||||||
|
#pragma vertex vert
|
||||||
|
#pragma fragment frag
|
||||||
|
|
||||||
|
half4 frag(v2f i) :COLOR {
|
||||||
|
return i.color;
|
||||||
|
}
|
||||||
|
ENDCG
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Fallback "Diffuse"
|
||||||
|
}
|
9
Assets/Shaders/Border.shader.meta
Normal file
9
Assets/Shaders/Border.shader.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bf662471a11144e48aefe2569a560ec9
|
||||||
|
ShaderImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultTextures: []
|
||||||
|
nonModifiableTextures: []
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -4,43 +4,8 @@
|
|||||||
QualitySettings:
|
QualitySettings:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 5
|
serializedVersion: 5
|
||||||
m_CurrentQuality: 5
|
m_CurrentQuality: 2
|
||||||
m_QualitySettings:
|
m_QualitySettings:
|
||||||
- serializedVersion: 2
|
|
||||||
name: Very Low
|
|
||||||
pixelLightCount: 0
|
|
||||||
shadows: 0
|
|
||||||
shadowResolution: 0
|
|
||||||
shadowProjection: 1
|
|
||||||
shadowCascades: 1
|
|
||||||
shadowDistance: 15
|
|
||||||
shadowNearPlaneOffset: 3
|
|
||||||
shadowCascade2Split: 0.33333334
|
|
||||||
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
|
|
||||||
shadowmaskMode: 0
|
|
||||||
blendWeights: 1
|
|
||||||
textureQuality: 1
|
|
||||||
anisotropicTextures: 0
|
|
||||||
antiAliasing: 0
|
|
||||||
softParticles: 0
|
|
||||||
softVegetation: 0
|
|
||||||
realtimeReflectionProbes: 0
|
|
||||||
billboardsFaceCameraPosition: 0
|
|
||||||
vSyncCount: 0
|
|
||||||
lodBias: 0.3
|
|
||||||
maximumLODLevel: 0
|
|
||||||
streamingMipmapsActive: 0
|
|
||||||
streamingMipmapsAddAllCameras: 1
|
|
||||||
streamingMipmapsMemoryBudget: 512
|
|
||||||
streamingMipmapsRenderersPerFrame: 512
|
|
||||||
streamingMipmapsMaxLevelReduction: 2
|
|
||||||
streamingMipmapsMaxFileIORequests: 1024
|
|
||||||
particleRaycastBudget: 4
|
|
||||||
asyncUploadTimeSlice: 2
|
|
||||||
asyncUploadBufferSize: 16
|
|
||||||
asyncUploadPersistentBuffer: 1
|
|
||||||
resolutionScalingFixedDPIFactor: 1
|
|
||||||
excludedTargetPlatforms: []
|
|
||||||
- serializedVersion: 2
|
- serializedVersion: 2
|
||||||
name: Low
|
name: Low
|
||||||
pixelLightCount: 0
|
pixelLightCount: 0
|
||||||
@ -53,7 +18,7 @@ QualitySettings:
|
|||||||
shadowCascade2Split: 0.33333334
|
shadowCascade2Split: 0.33333334
|
||||||
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
|
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
|
||||||
shadowmaskMode: 0
|
shadowmaskMode: 0
|
||||||
blendWeights: 2
|
skinWeights: 2
|
||||||
textureQuality: 0
|
textureQuality: 0
|
||||||
anisotropicTextures: 0
|
anisotropicTextures: 0
|
||||||
antiAliasing: 0
|
antiAliasing: 0
|
||||||
@ -75,6 +40,43 @@ QualitySettings:
|
|||||||
asyncUploadBufferSize: 16
|
asyncUploadBufferSize: 16
|
||||||
asyncUploadPersistentBuffer: 1
|
asyncUploadPersistentBuffer: 1
|
||||||
resolutionScalingFixedDPIFactor: 1
|
resolutionScalingFixedDPIFactor: 1
|
||||||
|
customRenderPipeline: {fileID: 0}
|
||||||
|
excludedTargetPlatforms: []
|
||||||
|
- serializedVersion: 2
|
||||||
|
name: Very Low
|
||||||
|
pixelLightCount: 0
|
||||||
|
shadows: 0
|
||||||
|
shadowResolution: 0
|
||||||
|
shadowProjection: 1
|
||||||
|
shadowCascades: 1
|
||||||
|
shadowDistance: 15
|
||||||
|
shadowNearPlaneOffset: 3
|
||||||
|
shadowCascade2Split: 0.33333334
|
||||||
|
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
|
||||||
|
shadowmaskMode: 0
|
||||||
|
skinWeights: 1
|
||||||
|
textureQuality: 1
|
||||||
|
anisotropicTextures: 0
|
||||||
|
antiAliasing: 0
|
||||||
|
softParticles: 0
|
||||||
|
softVegetation: 0
|
||||||
|
realtimeReflectionProbes: 0
|
||||||
|
billboardsFaceCameraPosition: 0
|
||||||
|
vSyncCount: 0
|
||||||
|
lodBias: 0.3
|
||||||
|
maximumLODLevel: 0
|
||||||
|
streamingMipmapsActive: 0
|
||||||
|
streamingMipmapsAddAllCameras: 1
|
||||||
|
streamingMipmapsMemoryBudget: 512
|
||||||
|
streamingMipmapsRenderersPerFrame: 512
|
||||||
|
streamingMipmapsMaxLevelReduction: 2
|
||||||
|
streamingMipmapsMaxFileIORequests: 1024
|
||||||
|
particleRaycastBudget: 4
|
||||||
|
asyncUploadTimeSlice: 2
|
||||||
|
asyncUploadBufferSize: 16
|
||||||
|
asyncUploadPersistentBuffer: 1
|
||||||
|
resolutionScalingFixedDPIFactor: 1
|
||||||
|
customRenderPipeline: {fileID: 0}
|
||||||
excludedTargetPlatforms: []
|
excludedTargetPlatforms: []
|
||||||
- serializedVersion: 2
|
- serializedVersion: 2
|
||||||
name: Medium
|
name: Medium
|
||||||
@ -88,7 +90,7 @@ QualitySettings:
|
|||||||
shadowCascade2Split: 0.33333334
|
shadowCascade2Split: 0.33333334
|
||||||
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
|
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
|
||||||
shadowmaskMode: 0
|
shadowmaskMode: 0
|
||||||
blendWeights: 2
|
skinWeights: 2
|
||||||
textureQuality: 0
|
textureQuality: 0
|
||||||
anisotropicTextures: 1
|
anisotropicTextures: 1
|
||||||
antiAliasing: 0
|
antiAliasing: 0
|
||||||
@ -110,6 +112,7 @@ QualitySettings:
|
|||||||
asyncUploadBufferSize: 16
|
asyncUploadBufferSize: 16
|
||||||
asyncUploadPersistentBuffer: 1
|
asyncUploadPersistentBuffer: 1
|
||||||
resolutionScalingFixedDPIFactor: 1
|
resolutionScalingFixedDPIFactor: 1
|
||||||
|
customRenderPipeline: {fileID: 0}
|
||||||
excludedTargetPlatforms: []
|
excludedTargetPlatforms: []
|
||||||
- serializedVersion: 2
|
- serializedVersion: 2
|
||||||
name: High
|
name: High
|
||||||
@ -123,7 +126,7 @@ QualitySettings:
|
|||||||
shadowCascade2Split: 0.33333334
|
shadowCascade2Split: 0.33333334
|
||||||
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
|
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
|
||||||
shadowmaskMode: 1
|
shadowmaskMode: 1
|
||||||
blendWeights: 2
|
skinWeights: 2
|
||||||
textureQuality: 0
|
textureQuality: 0
|
||||||
anisotropicTextures: 1
|
anisotropicTextures: 1
|
||||||
antiAliasing: 0
|
antiAliasing: 0
|
||||||
@ -145,6 +148,7 @@ QualitySettings:
|
|||||||
asyncUploadBufferSize: 16
|
asyncUploadBufferSize: 16
|
||||||
asyncUploadPersistentBuffer: 1
|
asyncUploadPersistentBuffer: 1
|
||||||
resolutionScalingFixedDPIFactor: 1
|
resolutionScalingFixedDPIFactor: 1
|
||||||
|
customRenderPipeline: {fileID: 0}
|
||||||
excludedTargetPlatforms: []
|
excludedTargetPlatforms: []
|
||||||
- serializedVersion: 2
|
- serializedVersion: 2
|
||||||
name: Very High
|
name: Very High
|
||||||
@ -158,7 +162,7 @@ QualitySettings:
|
|||||||
shadowCascade2Split: 0.33333334
|
shadowCascade2Split: 0.33333334
|
||||||
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
|
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
|
||||||
shadowmaskMode: 1
|
shadowmaskMode: 1
|
||||||
blendWeights: 4
|
skinWeights: 4
|
||||||
textureQuality: 0
|
textureQuality: 0
|
||||||
anisotropicTextures: 2
|
anisotropicTextures: 2
|
||||||
antiAliasing: 2
|
antiAliasing: 2
|
||||||
@ -180,6 +184,7 @@ QualitySettings:
|
|||||||
asyncUploadBufferSize: 16
|
asyncUploadBufferSize: 16
|
||||||
asyncUploadPersistentBuffer: 1
|
asyncUploadPersistentBuffer: 1
|
||||||
resolutionScalingFixedDPIFactor: 1
|
resolutionScalingFixedDPIFactor: 1
|
||||||
|
customRenderPipeline: {fileID: 0}
|
||||||
excludedTargetPlatforms: []
|
excludedTargetPlatforms: []
|
||||||
- serializedVersion: 2
|
- serializedVersion: 2
|
||||||
name: Ultra
|
name: Ultra
|
||||||
@ -193,7 +198,7 @@ QualitySettings:
|
|||||||
shadowCascade2Split: 0.33333334
|
shadowCascade2Split: 0.33333334
|
||||||
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
|
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
|
||||||
shadowmaskMode: 1
|
shadowmaskMode: 1
|
||||||
blendWeights: 4
|
skinWeights: 4
|
||||||
textureQuality: 0
|
textureQuality: 0
|
||||||
anisotropicTextures: 2
|
anisotropicTextures: 2
|
||||||
antiAliasing: 2
|
antiAliasing: 2
|
||||||
@ -215,6 +220,7 @@ QualitySettings:
|
|||||||
asyncUploadBufferSize: 16
|
asyncUploadBufferSize: 16
|
||||||
asyncUploadPersistentBuffer: 1
|
asyncUploadPersistentBuffer: 1
|
||||||
resolutionScalingFixedDPIFactor: 1
|
resolutionScalingFixedDPIFactor: 1
|
||||||
|
customRenderPipeline: {fileID: 0}
|
||||||
excludedTargetPlatforms: []
|
excludedTargetPlatforms: []
|
||||||
m_PerPlatformDefaultQuality:
|
m_PerPlatformDefaultQuality:
|
||||||
Android: 2
|
Android: 2
|
||||||
|
@ -5,6 +5,7 @@ TagManager:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
tags:
|
tags:
|
||||||
- Ground
|
- Ground
|
||||||
|
- Objects
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
Loading…
Reference in New Issue
Block a user