資源簡(jiǎn)介
(新手入門)使用U3D開發(fā)的跳一跳小游戲,入門級(jí),沒有復(fù)雜的代碼,只是簡(jiǎn)單的功能實(shí)現(xiàn),代碼使用C#,unity版本2017
適合初學(xué)者提升對(duì)U3D游戲開發(fā)的興趣
主要實(shí)現(xiàn)的功能:
1.按下鼠標(biāo)跳棋會(huì)壓縮,松開鼠標(biāo)跳棋跳出,跳出距離與按下鼠標(biāo)時(shí)間成正比,通過剛體實(shí)現(xiàn)
2.隨機(jī)生成圓柱形和方形的底座,底座大小隨機(jī),底座生成方向隨機(jī)
3.跳棋蓄力帶粒子特效(官方自帶),跳出帶有拖尾特效,特效資源來自網(wǎng)絡(luò)
4.一些簡(jiǎn)單的音效
5.一些簡(jiǎn)單的UI,包括分?jǐn)?shù)統(tǒng)計(jì)
代碼片段和文件信息
using?UnityEngine;
using?System.Collections;
using?System.Collections.Generic;
//?This?is?the?PocketRPG?weapon?trail.?For?best?results?itterate?it?and?your?animation?several?times?a?frame.
//?It?is?based?on?the?Tron?trails?Unity?example
//?PocketRPG?trails?run?faster?than?the?framerate...?(default?is?300?frames?a?second)...?that?is?how?they?are?so?smooth?(30fps?trails?are?rather?jerky)
//?This?code?was?written?by?Evan?Greenwood?(of?Free?Lives)?and?used?in?the?game?PocketRPG?by?Tasty?Poison?Games.
//?But?you?can?use?this?how?you?please...?Make?great?games...?that‘s?what?this?is?about.
//?This?code?is?provided?as?is.?Please?discuss?this?on?the?Unity?Forums?if?you?need?help.
//
class?TronTrailSection
{
public?Vector3?point;
????public?Vector3?upDir;
????public?float?time;
????public?TronTrailSection()?{
????}
????public?TronTrailSection(Vector3?p?float?t)?{
????????point?=?p;
????????time?=?t;
????}
}
[RequireComponent(typeof(MeshFilter))]
[AddComponentMenu(“PocketRPG/Weapon?Trail“)]
public?class?WeaponTrail?:?MonoBehaviour?{
????/*
?????Generates?a?trail?that?is?always?facing?upwards?using?the?scriptable?mesh?interface.?(This?is?from?the?Tron?Trails?in?Unity)
?????vertex?colors?and?uv‘s?are?generated?similar?to?the?builtin?Trail?Renderer.?But?it?DOES?NOT?RUN?ITSELF?LIKE?THE?TRAIL?RENDERER.?(there?is?no?update?method)
?????To?use?it
?????1.?Create?an?empty?game?object?(your?weapon)?with?it‘s?y?axis?pointing?along?the?weapons?blade.
?????2.?Attach?this?script?and?a?MeshRenderer
?????3.?Then?assign?a?particle?material?to?the?mesh?renderer
?????4.?Call?it‘s?Itterate?method?everytime?you?sample?the?animation?(if?you?want?a?smooth?trail?this?should?be?more?than?once?a?frame)
?????5.?Call?it‘s?UpdateTrail?method?once?a?frame?to?rebuild?the?mesh
????*/
????#region?Public
????public?float?height?=?2.0f;
????public?float?time?=?2.0f;
????public?bool?alwaysUp?=?false;
????public?float?minDistance?=?0.1f;??
public?float?timeTransitionSpeed?=?1f;
????public?float?desiredTime?=?2.0f;
????public?Color?startColor?=?Color.white;
????public?Color?endColor?=?new?Color(1?1?1?0);
????#endregion
????//
????#region?Temporary
????Vector3?position;
????float?now?=?0;
????TronTrailSection?currentSection;
????Matrix4x4?localSpaceTransform;
????#endregion
????#region?Internal
????private?Mesh?mesh;
????private?Vector3[]?vertices;
????private?Color[]?colors;
????private?Vector2[]?uv;
????#endregion
????#region?Customisers?
????private?MeshRenderer?meshRenderer;
????private?Material?trailMaterial;
????#endregion
????private?List?sections?=?new?List();
????void?Awake()?{
????????MeshFilter?meshF?=?GetComponent(typeof(MeshFilter))?as?MeshFilter;
????????mesh?=?meshF.mesh;
????????meshRenderer?=?GetComponent(typeof(MeshRenderer))?as?MeshRenderer;
????????trailMaterial?=?meshRenderer.material;
????}
????public?void?StartTrail(float?timeToTweenTo?float?fadeInTim
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
????..A..H.????355328??2018-02-26?21:37??GameUpUp\.vs\GameUpUp\v15\.suo
?????文件??????????0??2018-02-25?13:16??GameUpUp\.vs\GameUpUp\v15\Server\sqlite3\db.lock
?????文件????1142784??2018-02-26?21:37??GameUpUp\.vs\GameUpUp\v15\Server\sqlite3\storage.ide
????..A..H.?????35840??2018-01-03?22:03??GameUpUp\.vs\GameUpUp-csharp\v14\.suo
?????文件???????4127??2018-01-03?21:48??GameUpUp\Assembly-CSharp-vs.csproj
?????文件???????4127??2018-01-03?21:48??GameUpUp\Assembly-CSharp.csproj
?????文件??????16037??2018-02-26?10:56??GameUpUp\Assets\Audios\hold.mp3
????..A..H.???????500??2018-02-26?11:00??GameUpUp\Assets\Audios\hold.mp3.me
?????文件??????18744??2018-02-26?10:58??GameUpUp\Assets\Audios\MarioHoldFlag.mp3
????..A..H.???????500??2018-02-26?11:00??GameUpUp\Assets\Audios\MarioHoldFlag.mp3.me
?????文件??????35152??2018-02-26?10:43??GameUpUp\Assets\Audios\MarioJump.mp3
????..A..H.???????500??2018-02-26?11:00??GameUpUp\Assets\Audios\MarioJump.mp3.me
?????文件??????24552??2018-02-26?20:44??GameUpUp\Assets\Audios\MarioJump1.mp3
????..A..H.???????500??2018-02-26?20:44??GameUpUp\Assets\Audios\MarioJump1.mp3.me
?????文件??????24552??2018-02-26?20:44??GameUpUp\Assets\Audios\MarioJump2.mp3
????..A..H.???????500??2018-02-26?20:44??GameUpUp\Assets\Audios\MarioJump2.mp3.me
?????文件??????14042??2018-02-26?10:49??GameUpUp\Assets\Audios\ob
????..A..H.???????500??2018-02-26?11:00??GameUpUp\Assets\Audios\ob
?????文件??????39850??2018-02-26?10:50??GameUpUp\Assets\Audios\shua.mp3
????..A..H.???????500??2018-02-26?11:00??GameUpUp\Assets\Audios\shua.mp3.me
????..A..H.???????214??2018-02-26?11:00??GameUpUp\Assets\Audios.me
????I.A....??????4160??2018-02-25?17:52??GameUpUp\Assets\Materials\ba
????..A..H.???????231??2018-02-25?16:23??GameUpUp\Assets\Materials\ba
?????文件?????413712??2018-01-03?20:51??GameUpUp\Assets\Materials\Chessman\Chessman.fbx
????..A..H.??????2065??2018-01-03?20:56??GameUpUp\Assets\Materials\Chessman\Chessman.fbx.me
????I.A....??????5028??2018-02-25?17:52??GameUpUp\Assets\Materials\Chessman\Materials\lambert1.mat
????..A..H.???????180??2018-01-03?20:56??GameUpUp\Assets\Materials\Chessman\Materials\lambert1.mat.me
????..A..H.???????192??2018-01-03?20:56??GameUpUp\Assets\Materials\Chessman\Materials.me
????..A..H.???????192??2018-01-03?20:56??GameUpUp\Assets\Materials\Chessman.me
?????文件??????83131??2018-02-26?16:11??GameUpUp\Assets\Materials\Cursors\CursorClick.png
............此處省略2811個(gè)文件信息
評(píng)論
共有 條評(píng)論