Merge branch 'fishy-movement' into 'main'

Fishy movement

See merge request kt/fish-escape!1
This commit is contained in:
James H
2022-04-12 14:24:59 +00:00
8 changed files with 1263 additions and 26 deletions

View File

@@ -56,6 +56,7 @@ MeshRenderer:
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
@@ -80,6 +81,7 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!64 &7317411005216613472
MeshCollider:
m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

8
Assets/Scripts.meta Normal file
View File

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

View File

@@ -0,0 +1,51 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FishController : MonoBehaviour
{
public float speed = 4f;
public float gravity = -9.81f;
public float jumpSpeed = 8;
public Vector3 velocity;
public Vector3 drag;
CharacterController controller;
void Start()
{
controller = GetComponent<CharacterController>();
}
void Update()
{
float moveX = 0 - Input.GetAxisRaw("Vertical");
float moveZ = Input.GetAxisRaw("Horizontal");
float moveGravity = gravity * Time.deltaTime;
if (controller.isGrounded && velocity.y < 0)
{
velocity.y = 0;
}
if (Input.GetButtonDown("Jump") && controller.isGrounded)
{
velocity.y += jumpSpeed;
}
velocity.x = moveX * speed;
velocity.y += moveGravity;
transform.Rotate(0, moveZ, 0);
Vector3 moveVelocity = velocity * Time.deltaTime;
if (moveVelocity.y < 0 && Math.Abs(moveVelocity.y) < controller.minMoveDistance)
{
moveVelocity.y = (gravity * 0.1f) * Time.deltaTime;
}
controller.Move(transform.rotation * moveVelocity);
}
}

View File

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

View File

@@ -1,5 +1,6 @@
{
"dependencies": {
"com.unity.cinemachine": "2.6.11",
"com.unity.collab-proxy": "1.15.15",
"com.unity.ide.rider": "2.0.7",
"com.unity.ide.visualstudio": "2.0.14",
@@ -7,6 +8,7 @@
"com.unity.test-framework": "1.1.31",
"com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.4.8",
"com.unity.toolchain.linux-x86_64": "2.0.0",
"com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",

View File

@@ -1,5 +1,12 @@
{
"dependencies": {
"com.unity.cinemachine": {
"version": "2.6.11",
"depth": 0,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.collab-proxy": {
"version": "1.15.15",
"depth": 0,
@@ -50,6 +57,22 @@
},
"url": "https://packages.unity.com"
},
"com.unity.sysroot": {
"version": "2.0.0",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.sysroot.linux-x86_64": {
"version": "2.0.0",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.sysroot": "2.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.test-framework": {
"version": "1.1.31",
"depth": 0,
@@ -82,6 +105,16 @@
},
"url": "https://packages.unity.com"
},
"com.unity.toolchain.linux-x86_64": {
"version": "2.0.0",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.sysroot": "2.0.0",
"com.unity.sysroot.linux-x86_64": "2.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.ugui": {
"version": "1.0.0",
"depth": 0,

View File

@@ -4,5 +4,8 @@
EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes: []
m_Scenes:
- enabled: 1
path: Assets/Scenes/SampleScene.unity
guid: 9fc0d4010bbf28b4594072e72b8655ab
m_configObjects: {}