浏览代码

-Merged all changes and repaired issues

/demo-work-customrenderer
Mike Geig 5 年前
当前提交
97c4cb3a
共有 13 个文件被更改,包括 128 次插入63 次删除
  1. 5
      Assets/Objects/boats/Prefabs/_Boat.prefab
  2. 6
      Assets/Scripts/Boat/AIcontroller.cs
  3. 10
      Assets/Scripts/Boat/BoatController.cs
  4. 26
      Assets/Scripts/Boat/Engine.cs
  5. 10
      Assets/Scripts/GameSystem/RaceManager.cs
  6. 3
      Assets/Scripts/GameSystem/WaypointGroup.cs
  7. 8
      Assets/Unity Physics Items/AIController_DOTS.cs
  8. 18
      Assets/Unity Physics Items/Physics Scene.unity
  9. 16
      Assets/Unity Physics Items/Prefabs/AIBoatEntity Variant.prefab
  10. 54
      Assets/scenes/Island.unity
  11. 3
      Packages/manifest.json
  12. 32
      ProjectSettings/ProjectSettings.asset

5
Assets/Objects/boats/Prefabs/_Boat.prefab


m_EditorClassIdentifier:
Human: 0
RandomizeColors: 1
PrimaryColor: {r: 0.14775725, g: 0.07352568, b: 0.7352567, a: 1}
TrimColor: {r: 0.06331455, g: 0.03786368, b: 0.26474333, a: 1}
PrimaryColor: {r: 0.051685613, g: 0.13816722, b: 0.516856, a: 1}
TrimColor: {r: 0.483144, g: 0.402319, b: 0.048399623, a: 1}
boatRenderer: {fileID: 23139903168929634}
cam: {fileID: 2365855355768168390}
--- !u!114 &114571606569623246

m_Script: {fileID: 11500000, guid: 01c46922a8ed04b0081de10e51b3762f, type: 3}
m_Name:
m_EditorClassIdentifier:
RB: {fileID: 54710712322113256}
vel: {x: 0, y: 0, z: 0}
engineSound: {fileID: 82633756123786494}
waterSound: {fileID: 82912682702107868}

6
Assets/Scripts/Boat/AIcontroller.cs


// Use this for initialization
void Start ()
{
float delay = WaypointGroup.instance.raceDelay;
Invoke("GetNearestWP", delay);
float delay = WaypointGroup.raceDelay;
engine = GetComponent<Engine>(); // get the engine script
Invoke("GetNearestWP", delay);
}
// Update is called once per frame

10
Assets/Scripts/Boat/BoatController.cs


Colourize(); // Update the colour material property block
}
// Use this for initialization
void Awake()
void Awake()
{
Colourize();
}
// Use this for initialization
void Start()
Colourize();
if (Human)
{
gameObject.AddComponent<HumanController>(); // Adds a human controller if human

26
Assets/Scripts/Boat/Engine.cs


using System.Collections;
using WaterSystem;
using Unity.Mathematics;
using Unity.Entities;
namespace BoatAttack.Boat
{

void Awake()
{
engineSound.time = UnityEngine.Random.Range(0f, engineSound.clip.length); // randomly start the engine sound
RB = gameObject.GetComponent<Rigidbody>();
engineSound.time = UnityEngine.Random.Range(0f, engineSound.clip.length); // randomly start the engine sound
waterSound.time = UnityEngine.Random.Range(0f, waterSound.clip.length); // randomly start the water sound
_guid = this.GetInstanceID(); // Get the engines GUID for the buoyancy system

Gizmos.matrix = transform.localToWorldMatrix;
Gizmos.DrawCube(enginePosition, new Vector3(0.1f, 0.2f, 0.3f)); // Draw teh engine position with sphere
}
}
//Called by parent BuoyantObject_DOTS
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
//Set up driving data
bool isHuman = GetComponent<BoatController>().Human;
if (!isHuman)
AIController_DOTS.Register(entity);
var data = new DrivingData
{
isHuman = isHuman,
torque = torque,
horsePower = horsePower,
engineOffset = transform.TransformPoint(enginePosition) - transform.position
};
dstManager.AddComponentData(entity, data);
}
}
}

10
Assets/Scripts/GameSystem/RaceManager.cs


public bool reversed;
}
public Race raceData;
public bool useDOTS;
public GameObject humanBoat;
public GameObject aiBoat;
public Race raceData;
private void Start()
{

{
var matrix = WaypointGroup.instance.startingPositons[i];
GameObject boatObject = Instantiate(boat.boatPrefab, matrix.GetColumn(3), Quaternion.LookRotation(matrix.GetColumn(2))) as GameObject;
var prefab = useDOTS ? (boat.Human ? humanBoat : aiBoat) : boat.boatPrefab;
GameObject boatObject = Instantiate(prefab, matrix.GetColumn(3), Quaternion.LookRotation(matrix.GetColumn(2))) as GameObject;
boatObject.name = boat.boatName;
BoatController boatController = boatObject.GetComponent<BoatController>();
boatController.Human = boat.Human;

3
Assets/Scripts/GameSystem/WaypointGroup.cs


public class WaypointGroup : MonoBehaviour
{
static WaypointGroup Instance = null;
public static float raceDelay = 4f;
public float raceDelay = 4f;
public bool raceStarted = false;
[NonSerialized]

8
Assets/Unity Physics Items/AIController_DOTS.cs


if (data.pathPoint == null)
{
WaypointGroup.Waypoint wp = WaypointGroup.Instance.GetClosestWaypoint(pos);
CalculatePath(WaypointGroup.Instance.GetNextWaypoint(wp), data, pos);
WaypointGroup.Waypoint wp = WaypointGroup.instance.GetClosestWaypoint(pos);
CalculatePath(WaypointGroup.instance.GetNextWaypoint(wp), data, pos);
}
else if (data.pathPoint.Length > data.curPoint && data.foundPath)
{

if (data.curPoint >= data.pathPoint.Length)
CalculatePath(WaypointGroup.Instance.GetWaypoint(data.curWP), data, pos);
CalculatePath(WaypointGroup.instance.GetWaypoint(data.curWP), data, pos);
}
}

var curWPPos = wp.point + wp.rotation * offset;
data.curWP++;
if (data.curWP >= WaypointGroup.Instance.WPs.Count)
if (data.curWP >= WaypointGroup.instance.WPs.Count)
data.curWP = 0;
var navPath = new NavMeshPath(); // New nav path

18
Assets/Unity Physics Items/Physics Scene.unity


m_Script: {fileID: 11500000, guid: ce2d6128fa5c04c7e84e7978ef8b37a4, type: 3}
m_Name:
m_EditorClassIdentifier:
useDOTS: 1
humanBoat: {fileID: 3457973740146875416, guid: 0a308b87c1579fb4c9ea256406209ca5,
type: 3}
aiBoat: {fileID: 980501028647124811, guid: c48ad8112d3b604478deaa848d47c861, type: 3}
boatPrefab: {fileID: 3457973740146875416, guid: 0a308b87c1579fb4c9ea256406209ca5,
boatPrefab: {fileID: 1553288845585282, guid: fc3ffb83d6eafb1489a5b23bc82d25b6,
boatPrefab: {fileID: 3457973740146875416, guid: 0a308b87c1579fb4c9ea256406209ca5,
boatPrefab: {fileID: 1553288845585282, guid: fc3ffb83d6eafb1489a5b23bc82d25b6,
boatPrefab: {fileID: 3457973740146875416, guid: 0a308b87c1579fb4c9ea256406209ca5,
boatPrefab: {fileID: 1553288845585282, guid: fc3ffb83d6eafb1489a5b23bc82d25b6,
boatPrefab: {fileID: 3457973740146875416, guid: 0a308b87c1579fb4c9ea256406209ca5,
boatPrefab: {fileID: 1553288845585282, guid: fc3ffb83d6eafb1489a5b23bc82d25b6,
humanBoat: {fileID: 3457973740146875416, guid: 0a308b87c1579fb4c9ea256406209ca5,
type: 3}
aiBoat: {fileID: 980501028647124811, guid: c48ad8112d3b604478deaa848d47c861, type: 3}
--- !u!114 &208737148
MonoBehaviour:
m_ObjectHideFlags: 0

m_RenderShadows: 1
m_RequiresDepthTextureOption: 2
m_RequiresOpaqueTextureOption: 2
m_RendererOverrideOption: 1
m_RendererData: {fileID: 11400000, guid: fa301df1a78cf4a9ebe2a3139dc8be8f, type: 2}
m_RendererIndex: -1
m_VolumeLayerMask:
serializedVersion: 2
m_Bits: 1

16
Assets/Unity Physics Items/Prefabs/AIBoatEntity Variant.prefab


- target: {fileID: 3457973740146875416, guid: 0a308b87c1579fb4c9ea256406209ca5,
type: 3}
propertyPath: m_Name
value: BoatEntity
value: AIBoatEntity Variant
objectReference: {fileID: 0}
- target: {fileID: 3457973740146875416, guid: 0a308b87c1579fb4c9ea256406209ca5,
type: 3}

- target: {fileID: 6727757724182940452, guid: 0a308b87c1579fb4c9ea256406209ca5,
type: 3}
propertyPath: PrimaryColor.r
value: 0.7434182
value: 0.8960905
value: 0.7434182
value: 0.8960905
value: 0.7434182
value: 0.8960905
value: 0.025658185
value: 0.10390949
value: 0.15348418
value: 0.010390951
value: 0.25658178
value: 0.030251522
objectReference: {fileID: 0}
- target: {fileID: 6727757724182940452, guid: 0a308b87c1579fb4c9ea256406209ca5,
type: 3}

- target: {fileID: 320792261470743900, guid: 0a308b87c1579fb4c9ea256406209ca5,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 558137786967539335, guid: 0a308b87c1579fb4c9ea256406209ca5,
type: 3}

54
Assets/scenes/Island.unity


m_OnCameraLive:
m_PersistentCalls:
m_Calls: []
m_TypeName: Cinemachine.CinemachineBrain+VcamActivatedEvent, Cinemachine, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 602916014}
--- !u!95 &56310422

m_OnCameraLive:
m_PersistentCalls:
m_Calls: []
m_TypeName: Cinemachine.CinemachineBrain+VcamActivatedEvent, Cinemachine, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 36699175}
--- !u!95 &96716010

m_Script: {fileID: 11500000, guid: ce2d6128fa5c04c7e84e7978ef8b37a4, type: 3}
m_Name:
m_EditorClassIdentifier:
useDOTS: 1
humanBoat: {fileID: 3457973740146875416, guid: 0a308b87c1579fb4c9ea256406209ca5,
type: 3}
aiBoat: {fileID: 980501028647124811, guid: c48ad8112d3b604478deaa848d47c861, type: 3}
raceData:
boats:
- boatName: Boogie

m_OnCameraLive:
m_PersistentCalls:
m_Calls: []
m_TypeName: Cinemachine.CinemachineBrain+VcamActivatedEvent, Cinemachine, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 141728621}
--- !u!95 &598956453

m_OnCameraLive:
m_PersistentCalls:
m_Calls: []
m_TypeName: Cinemachine.CinemachineBrain+VcamActivatedEvent, Cinemachine, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 2007948142}
--- !u!95 &674622426

m_OnCameraLive:
m_PersistentCalls:
m_Calls: []
m_TypeName: Cinemachine.CinemachineBrain+VcamActivatedEvent, Cinemachine, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 1095320328}
--- !u!95 &681645760

m_OnCameraLive:
m_PersistentCalls:
m_Calls: []
m_TypeName: Cinemachine.CinemachineBrain+VcamActivatedEvent, Cinemachine, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 198446339}
--- !u!1 &1017609894

m_CameraCutEvent:
m_PersistentCalls:
m_Calls: []
m_TypeName: Cinemachine.CinemachineBrain+BrainEvent, Cinemachine, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
m_TypeName: Cinemachine.CinemachineBrain+VcamActivatedEvent, Cinemachine, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &1017609904
MonoBehaviour:
m_ObjectHideFlags: 0

m_OnCameraLive:
m_PersistentCalls:
m_Calls: []
m_TypeName: Cinemachine.CinemachineBrain+VcamActivatedEvent, Cinemachine, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 1821796557}
--- !u!95 &1431392952

m_OnCameraLive:
m_PersistentCalls:
m_Calls: []
m_TypeName: Cinemachine.CinemachineBrain+VcamActivatedEvent, Cinemachine, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 871694112}
--- !u!95 &1881355362

m_OnCameraLive:
m_PersistentCalls:
m_Calls: []
m_TypeName: Cinemachine.CinemachineBrain+VcamActivatedEvent, Cinemachine, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 1873663219}
--- !u!1001 &6589000189408555943

propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6589000190618102542, guid: e70416e3bc35d4004a9981d0ac102ba5,
type: 3}
propertyPath: m_LocalRotation.y
value: 0.72625333
objectReference: {fileID: 0}
- target: {fileID: 6589000190618102542, guid: e70416e3bc35d4004a9981d0ac102ba5,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.68427867
objectReference: {fileID: 0}
- target: {fileID: 6589000189523060542, guid: e70416e3bc35d4004a9981d0ac102ba5,
type: 3}
propertyPath: m_IsActive

m_SourcePrefab: {fileID: 100100000, guid: e70416e3bc35d4004a9981d0ac102ba5, type: 3}
--- !u!1 &6589000189408555944 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1753825905008727154, guid: e70416e3bc35d4004a9981d0ac102ba5,
type: 3}
m_PrefabInstance: {fileID: 6589000189408555943}
m_PrefabAsset: {fileID: 0}
--- !u!114 &6589000189408555945
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6589000189408555944}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d535e331fdb3f734cb363f09fa881545, type: 3}
m_Name:
m_EditorClassIdentifier:

3
Packages/manifest.json


"com.unity.burst": "1.1.2",
"com.unity.cinemachine": "2.3.4",
"com.unity.collab-proxy": "1.2.16",
"com.unity.entities": "0.1.1-preview",
"com.unity.physics": "0.2.0-preview",
"com.unity.rendering.hybrid": "0.1.1-preview",
"com.unity.test-framework": "1.0.17",
"com.unity.textmeshpro": "2.0.1",
"com.unity.timeline": "1.1.0",

32
ProjectSettings/ProjectSettings.asset


--- !u!129 &1
PlayerSettings:
m_ObjectHideFlags: 0
serializedVersion: 19
serializedVersion: 18
productGUID: b53215438aaf44a9f9817e608bbb159c
AndroidProfiler: 0
AndroidFilterTouchesWhenObscured: 0

m_StackTraceTypes: 010000000100000001000000000000000100000001000000
iosShowActivityIndicatorOnLoading: -1
androidShowActivityIndicatorOnLoading: -1
iosUseCustomAppBackgroundBehavior: 0
iosAppInBackgroundBehavior: 0
iosAllowHTTPDownload: 1
allowedAutorotateToPortrait: 1
allowedAutorotateToPortraitUpsideDown: 1

useMacAppStoreValidation: 0
macAppStoreCategory: public.app-category.games
gpuSkinning: 0
graphicsJobs: 0
xboxPIXTextureCapture: 0
xboxEnableAvatar: 0
xboxEnableKinect: 0

- m_BuildTarget: Android
m_StaticBatching: 1
m_DynamicBatching: 0
m_BuildTargetGraphicsJobs:
- m_BuildTarget: MacStandaloneSupport
m_GraphicsJobs: 1
- m_BuildTarget: Switch
m_GraphicsJobs: 1
- m_BuildTarget: MetroSupport
m_GraphicsJobs: 1
- m_BuildTarget: AppleTVSupport
m_GraphicsJobs: 0
- m_BuildTarget: BJMSupport
m_GraphicsJobs: 1
- m_BuildTarget: LinuxStandaloneSupport
m_GraphicsJobs: 1
- m_BuildTarget: PS4Player
m_GraphicsJobs: 1
- m_BuildTarget: iOSSupport
m_GraphicsJobs: 0
- m_BuildTarget: WindowsStandaloneSupport
m_GraphicsJobs: 1
- m_BuildTarget: XboxOnePlayer
m_GraphicsJobs: 1
- m_BuildTarget: LuminSupport
m_GraphicsJobs: 0
- m_BuildTarget: AndroidPlayer
m_GraphicsJobs: 0
- m_BuildTarget: WebGLSupport
m_GraphicsJobs: 0
m_BuildTargetGraphicsAPIs:
- m_BuildTarget: iOSSupport
m_APIs: 10000000

正在加载...
取消
保存