-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
2. 增加不同类型的障碍物; 3. 增加具有简单 AI 的敌人。
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Unity Editor", | ||
"type": "unity", | ||
"request": "launch" | ||
}, | ||
{ | ||
"name": "Windows Player", | ||
"type": "unity", | ||
"request": "launch" | ||
}, | ||
{ | ||
"name": "OSX Player", | ||
"type": "unity", | ||
"request": "launch" | ||
}, | ||
{ | ||
"name": "Linux Player", | ||
"type": "unity", | ||
"request": "launch" | ||
}, | ||
{ | ||
"name": "iOS Player", | ||
"type": "unity", | ||
"request": "launch" | ||
}, | ||
{ | ||
"name": "Android Player", | ||
"type": "unity", | ||
"request": "launch" | ||
|
||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"files.exclude": | ||
{ | ||
"**/.DS_Store":true, | ||
"**/.git":true, | ||
"**/.gitignore":true, | ||
"**/.gitmodules":true, | ||
"**/*.booproj":true, | ||
"**/*.pidb":true, | ||
"**/*.suo":true, | ||
"**/*.user":true, | ||
"**/*.userprefs":true, | ||
"**/*.unityproj":true, | ||
"**/*.dll":true, | ||
"**/*.exe":true, | ||
"**/*.pdf":true, | ||
"**/*.mid":true, | ||
"**/*.midi":true, | ||
"**/*.wav":true, | ||
"**/*.gif":true, | ||
"**/*.ico":true, | ||
"**/*.jpg":true, | ||
"**/*.jpeg":true, | ||
"**/*.png":true, | ||
"**/*.psd":true, | ||
"**/*.tga":true, | ||
"**/*.tif":true, | ||
"**/*.tiff":true, | ||
"**/*.3ds":true, | ||
"**/*.3DS":true, | ||
"**/*.fbx":true, | ||
"**/*.FBX":true, | ||
"**/*.lxo":true, | ||
"**/*.LXO":true, | ||
"**/*.ma":true, | ||
"**/*.MA":true, | ||
"**/*.obj":true, | ||
"**/*.OBJ":true, | ||
"**/*.asset":true, | ||
"**/*.cubemap":true, | ||
"**/*.flare":true, | ||
"**/*.mat":true, | ||
"**/*.meta":true, | ||
"**/*.prefab":true, | ||
"**/*.unity":true, | ||
"build/":true, | ||
"Build/":true, | ||
"Library/":true, | ||
"library/":true, | ||
"obj/":true, | ||
"Obj/":true, | ||
"ProjectSettings/":true, | ||
"temp/":true, | ||
"Temp/":true | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Seamless support for Microsoft Visual Studio Code in Unity | ||
* | ||
* Version: | ||
* 2.7 | ||
* 2.8 | ||
* | ||
* Authors: | ||
* Matthew Davey <[email protected]> | ||
|
@@ -23,7 +23,7 @@ public static class VSCode | |
/// <summary> | ||
/// Current Version Number | ||
/// </summary> | ||
public const float Version = 2.7f; | ||
public const float Version = 2.8f; | ||
|
||
/// <summary> | ||
/// Current Version Code | ||
|
@@ -33,7 +33,7 @@ public static class VSCode | |
/// <summary> | ||
/// Additional File Extensions | ||
/// </summary> | ||
public const string FileExtensions = ".ts, .bjs, .javascript, .json, .html"; | ||
public const string FileExtensions = ".ts, .bjs, .javascript, .json, .html, .shader, .template"; | ||
|
||
/// <summary> | ||
/// Download URL for Unity Debbuger | ||
|
@@ -1275,6 +1275,10 @@ static void WriteWorkspaceSettings() | |
"\t\t\"**/.gitmodules\":true,\n" + | ||
"\t\t\"**/.svn\":true,\n" + | ||
|
||
// Compressed Files | ||
"\t\t\"**/*.zip\":true,\n" + | ||
"\t\t\"**/*.gz\":true,\n" + | ||
"\t\t\"**/*.7z\":true,\n" + | ||
|
||
// Project Files | ||
"\t\t\"**/*.booproj\":true,\n" + | ||
|
@@ -1332,6 +1336,8 @@ static void WriteWorkspaceSettings() | |
"\t\t\"**/*.meta\":true,\n" + | ||
"\t\t\"**/*.prefab\":true,\n" + | ||
"\t\t\"**/*.unity\":true,\n" + | ||
"\t\t\"**/*.anim\":true,\n" + | ||
"\t\t\"**/*.controller\":true,\n" + | ||
|
||
// Folders | ||
"\t\t\"build/\":true,\n" + | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using UnityEngine; | ||
|
||
public class BGScroller : MonoBehaviour | ||
{ | ||
|
||
[SerializeField] | ||
private float scrollSpeed; | ||
[SerializeField] | ||
private float tileSizeZ; | ||
|
||
private Vector3 startPosition; | ||
|
||
void Start() | ||
{ | ||
startPosition = transform.position; | ||
} | ||
|
||
void Update() | ||
{ | ||
float newPosition = Mathf.Repeat(Time.time * scrollSpeed, tileSizeZ); | ||
transform.position = startPosition + Vector3.forward * newPosition; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using System.Collections; | ||
using UnityEngine; | ||
|
||
public class EvasiveManeuver : MonoBehaviour | ||
{ | ||
[SerializeField] | ||
private Boundary boundary; | ||
[SerializeField] | ||
private float tilt; | ||
[SerializeField] | ||
private float dodge; | ||
[SerializeField] | ||
private float smoothing; | ||
[SerializeField] | ||
private float speed; | ||
|
||
[SerializeField] | ||
private Vector2 startWait; | ||
[SerializeField] | ||
private Vector2 maneuverTime; | ||
[SerializeField] | ||
private Vector2 maneuverWait; | ||
|
||
private float _targetManeuver; | ||
private Rigidbody _rigidbody; | ||
private float _currentSpeed; | ||
|
||
private GameObject _player; | ||
private bool _isTracking; | ||
|
||
void Start() | ||
{ | ||
_rigidbody = GetComponent<Rigidbody>(); | ||
_currentSpeed = _rigidbody.velocity.z; | ||
|
||
_player = GameObject.FindWithTag("Player"); | ||
|
||
if (null != _player) | ||
{ | ||
_isTracking = (Random.value < 0.5); | ||
} | ||
else | ||
{ | ||
_isTracking = false; | ||
} | ||
|
||
StartCoroutine(Evade()); | ||
} | ||
|
||
IEnumerator Evade() | ||
{ | ||
yield return new WaitForSeconds(Random.Range(startWait.x, startWait.y)); | ||
|
||
while (true) | ||
{ | ||
_targetManeuver = Random.Range(1.0f, dodge) * -Mathf.Sign(transform.position.x); | ||
yield return new WaitForSeconds(Random.Range(maneuverTime.x, maneuverTime.y)); | ||
_targetManeuver = 0.0f; | ||
yield return new WaitForSeconds(Random.Range(maneuverWait.x, maneuverWait.y)); | ||
} | ||
} | ||
|
||
void FixedUpdate() | ||
{ | ||
float newManeuver = Mathf.MoveTowards(_rigidbody.velocity.x, _targetManeuver, Time.deltaTime * smoothing); | ||
|
||
float movement; | ||
|
||
if (null != _player && _isTracking) | ||
{ | ||
movement = Mathf.MoveTowards(_rigidbody.position.x, _player.transform.position.x, Time.deltaTime * speed); | ||
} | ||
else | ||
{ | ||
movement = _rigidbody.position.x; | ||
_rigidbody.velocity = new Vector3(newManeuver, 0.0f, _currentSpeed); | ||
} | ||
|
||
_rigidbody.position = new Vector3 | ||
( | ||
Mathf.Clamp(movement, boundary.xMin, boundary.xMax), | ||
0.0f, | ||
Mathf.Clamp(_rigidbody.position.z, boundary.zMin, boundary.zMax) | ||
); | ||
_rigidbody.rotation = Quaternion.Euler(0.0f, 0.0f, _rigidbody.velocity.x * -tilt); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.