Add bobbing prototype
This commit is contained in:
parent
7f5ab91d2f
commit
086a47af72
@ -27,7 +27,7 @@ Transform:
|
|||||||
m_LocalPosition: {x: 0, y: 0.45, z: 0}
|
m_LocalPosition: {x: 0, y: 0.45, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 8489029732530782807}
|
m_Father: {fileID: 4562179207922364650}
|
||||||
m_RootOrder: 4
|
m_RootOrder: 4
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &590584242949539293
|
--- !u!1 &590584242949539293
|
||||||
@ -57,7 +57,7 @@ Transform:
|
|||||||
m_LocalPosition: {x: 0.15, y: 0.45, z: 0}
|
m_LocalPosition: {x: 0.15, y: 0.45, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 8489029732530782807}
|
m_Father: {fileID: 4562179207922364650}
|
||||||
m_RootOrder: 3
|
m_RootOrder: 3
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &2055525761678926607
|
--- !u!1 &2055525761678926607
|
||||||
@ -87,7 +87,7 @@ Transform:
|
|||||||
m_LocalPosition: {x: -0.15, y: 0.45, z: 0}
|
m_LocalPosition: {x: -0.15, y: 0.45, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 8489029732530782807}
|
m_Father: {fileID: 4562179207922364650}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &4843835016145658905
|
--- !u!1 &4843835016145658905
|
||||||
@ -199,7 +199,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 340836170559364036}
|
- {fileID: 340836170559364036}
|
||||||
m_Father: {fileID: 8489029732530782807}
|
m_Father: {fileID: 4562179207922364650}
|
||||||
m_RootOrder: 5
|
m_RootOrder: 5
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &6171388266710565393
|
--- !u!1 &6171388266710565393
|
||||||
@ -274,6 +274,42 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
Punching: 0
|
Punching: 0
|
||||||
|
--- !u!1 &8415983742588921903
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 4562179207922364650}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: BobberParent
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &4562179207922364650
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8415983742588921903}
|
||||||
|
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_Children:
|
||||||
|
- {fileID: 8489029732599905345}
|
||||||
|
- {fileID: 8489029732241002785}
|
||||||
|
- {fileID: 6758694282293649363}
|
||||||
|
- {fileID: 1270933798917005542}
|
||||||
|
- {fileID: 3118287694834230934}
|
||||||
|
- {fileID: 8334477035414792174}
|
||||||
|
m_Father: {fileID: 8489029732530782807}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &8489029732241002798
|
--- !u!1 &8489029732241002798
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -303,7 +339,7 @@ Transform:
|
|||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 8489029732530782807}
|
m_Father: {fileID: 4562179207922364650}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!212 &8489029732241002784
|
--- !u!212 &8489029732241002784
|
||||||
@ -388,6 +424,7 @@ GameObject:
|
|||||||
- component: {fileID: 412028545510300634}
|
- component: {fileID: 412028545510300634}
|
||||||
- component: {fileID: 8489029732530782806}
|
- component: {fileID: 8489029732530782806}
|
||||||
- component: {fileID: 5050980832709922958}
|
- component: {fileID: 5050980832709922958}
|
||||||
|
- component: {fileID: 5620918083888341557}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Player
|
m_Name: Player
|
||||||
m_TagString: Player
|
m_TagString: Player
|
||||||
@ -406,12 +443,7 @@ Transform:
|
|||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 8489029732599905345}
|
- {fileID: 4562179207922364650}
|
||||||
- {fileID: 8489029732241002785}
|
|
||||||
- {fileID: 6758694282293649363}
|
|
||||||
- {fileID: 1270933798917005542}
|
|
||||||
- {fileID: 3118287694834230934}
|
|
||||||
- {fileID: 8334477035414792174}
|
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
@ -501,6 +533,22 @@ MonoBehaviour:
|
|||||||
FurnitureExplosionFun: 4
|
FurnitureExplosionFun: 4
|
||||||
ShootingFunAmount: 0.2
|
ShootingFunAmount: 0.2
|
||||||
DebugAdd10Fun: 0
|
DebugAdd10Fun: 0
|
||||||
|
--- !u!114 &5620918083888341557
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8489029732530782804}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: e796ba4c6f7efc449a10ed13ee42e34f, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
BobbedTransform: {fileID: 4562179207922364650}
|
||||||
|
BobbingGravity: 1.5
|
||||||
|
BobbingLaunchSpeed: 0.25
|
||||||
|
BobbingDirection: {x: 0, y: 1}
|
||||||
--- !u!1 &8489029732599905358
|
--- !u!1 &8489029732599905358
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -530,7 +578,7 @@ Transform:
|
|||||||
m_LocalPosition: {x: 0, y: 0.4, z: 0}
|
m_LocalPosition: {x: 0, y: 0.4, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 8489029732530782807}
|
m_Father: {fileID: 4562179207922364650}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!212 &8489029732599905344
|
--- !u!212 &8489029732599905344
|
||||||
|
27
Assets/Scripts/Effects/Bobbing.cs
Normal file
27
Assets/Scripts/Effects/Bobbing.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class Bobbing : MonoBehaviour {
|
||||||
|
|
||||||
|
public Transform BobbedTransform;
|
||||||
|
|
||||||
|
public float BobbingGravity = 0.5f;
|
||||||
|
public float BobbingLaunchSpeed = 5f;
|
||||||
|
public Vector2 BobbingDirection = new Vector2(0, 1);
|
||||||
|
|
||||||
|
private float BobbingSpeed;
|
||||||
|
|
||||||
|
private float CurrentBobbingState = 0;
|
||||||
|
|
||||||
|
void Update() {
|
||||||
|
BobbingSpeed -= BobbingGravity / 10 * Time.deltaTime;
|
||||||
|
if (CurrentBobbingState <= 0) {
|
||||||
|
BobbingSpeed = BobbingLaunchSpeed / 10;
|
||||||
|
}
|
||||||
|
CurrentBobbingState += BobbingSpeed;
|
||||||
|
|
||||||
|
BobbedTransform.localPosition = BobbingDirection * CurrentBobbingState;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Effects/Bobbing.cs.meta
Normal file
11
Assets/Scripts/Effects/Bobbing.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e796ba4c6f7efc449a10ed13ee42e34f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user