This commit is contained in:
2024-10-16 00:03:41 +08:00
commit 897058435c
5033 changed files with 1009728 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
using UnityEngine;
using System.Collections;
public class Ball : MonoBehaviour {
// Update is called once per frame
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 0ab70292744e9c9448bf89c713e8d90a
timeCreated: 1456741077
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 200
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,82 @@
using UnityEngine;
using System.Collections;
using HedgehogTeam.EasyTouch;
public class BallRunPlayer : MonoBehaviour {
public Transform ballModel;
private bool start =false;
private Vector3 moveDirection;
private CharacterController characterController;
private Vector3 startPosition;
private bool isJump = false;
void OnEnable(){
EasyTouch.On_SwipeEnd += On_SwipeEnd;
}
void OnDestroy(){
EasyTouch.On_SwipeEnd -= On_SwipeEnd;
}
void Start(){
characterController = GetComponent<CharacterController>();
startPosition = transform.position;
}
void Update () {
if (start){
moveDirection = transform.TransformDirection(Vector3.forward)* 10f * Time.deltaTime;
moveDirection.y -= 9.81f * Time.deltaTime;
if (isJump){
moveDirection.y = 8f;
isJump = false;
}
characterController.Move( moveDirection);
ballModel.Rotate( Vector3.right * 400 * Time.deltaTime);
}
if (transform.position.y<0.5){
start=false;
transform.position = startPosition;
}
}
void OnCollision(){
Debug.Log("ok");
}
void On_SwipeEnd (Gesture gesture){
if (start){
switch (gesture.swipe){
case EasyTouch.SwipeDirection.DownLeft:
case EasyTouch.SwipeDirection.UpLeft:
case EasyTouch.SwipeDirection.Left:
transform.Rotate(Vector3.up * -90);
break;
case EasyTouch.SwipeDirection.DownRight:
case EasyTouch.SwipeDirection.UpRight:
case EasyTouch.SwipeDirection.Right:
transform.Rotate(Vector3.up * 90);
break;
case EasyTouch.SwipeDirection.Up:
if (characterController.isGrounded){
isJump = true;
}
break;
}
}
}
public void StartGame(){
start = true;
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: f2c2690da05f1ee41b37fea93ee7fd77
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,31 @@
using UnityEngine;
using System.Collections;
using HedgehogTeam.EasyTouch;
public class ThirdPersonCamera : MonoBehaviour
{
public float distanceAway; // distance from the back of the craft
public float distanceUp; // distance above the craft
public float smooth; // how smooth the camera movement is
private GameObject hovercraft; // to store the hovercraft
private Vector3 targetPosition; // the position the camera is trying to be in
Transform follow;
void Start(){
follow = GameObject.FindWithTag ("Player").transform;
}
void LateUpdate ()
{
// setting the target position to be the correct offset from the hovercraft
targetPosition = follow.position + Vector3.up * distanceUp - follow.forward * distanceAway;
// making a smooth transition between it's current position and the position it wants to be in
transform.position = Vector3.Lerp(transform.position, targetPosition, Time.deltaTime * smooth);
// make sure the camera is looking the right way!
transform.LookAt(follow);
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: d84d76fc294bc384d9ea022f75bf9fe1
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: