This is an ongoing Pull Request, not finished yet, please do not merge for now.
To display Traffic UI
Simply add TrafficUIController from Prefab into the current scene.
To use drag-and-drop function powered by TouchScript
Add TouchManager to the Hierarchy.
[Optional] Add Cursors to the Hierarchy to display when tap, mainly for debugging, should not be included in the final beta build.
Add Standard Layer Component to Main Camer in the scene, in most cases, just enable Hit 3D Objects for interaction with 3D GameObject. Enabling all of them may result in failing to detect the actual object the cursor is hitting.
For the 3D GameObject you want to drag-and-drop, add Component Transformer, Transform Gesture, and a Collider. In our case, please only enable Translation in the Transform Type in Transform Gesture and remain other settings unchanged.
Copy Player1_TrafficSignLibrary and Player2_TrafficSignLibrary from PlayScnene_TrafficRule scene to your scene.
Refer above GameObjects in GameManger (If you don't want to use the traffic sign mechanic in your scene, just refer to an empty GameObject for now)
For the track block you want to make it traffic-sign-holdable, add TrafficSignHolder script as a component to it.
To resize the GameObject standing on the track block after dropping that traffic sign, please directly resize the StandingSign_xxx in the Prefabs folder, it will automatically take effect for all scenes.
To implement the actual traffic rule functions, @YuehCorazon please implement it in StandingTrafficSign.cs proper blocks (I've already added TODO keywords).
Summary
Resources
[x] Import Traffic Sign assets for art resources.
[x] Import TouchScript assets to reimplement the drag-and-drop logic.
Functionalities
[x] Implement the UI display logic of Traffic Signs.
[x] Support dragging traffic signs in the editing phase (with turn-based control).
[x] Support dropping on the blocks with TrafficSignHolder component. (will calculate the closest one, see DraggableTrafficSign.cs for details)
[x] Support changing the style from flat traffic signs to standing traffic signs after dropping onto traffic sign holder block (should refer to the corresponding 3D Prefab in Unity Editor Inspector, see DraggableTrafficSign.cs for details).
[x] Remove the TileMechanics component from the current TerrainFlat prefab. We may discuss the implementation details later @YuehCorazon
[x] Setting proper Colliders for triggering the traffic rule.
[x] Implement the UI pagination logic of traffic signs @aartiDBarai.
[x] Implement the traffic sign selection limit logic.
[x] Setting traffic sign standing points for each block.
Scene Modification
[x] Replace all Map00 block with TerrainStartingBlock prefab.
[x] Replace all Map22 block with TerrainFinishBlock prefab.
Note
This is an ongoing Pull Request, not finished yet, please do not merge for now.
To display Traffic UI
TrafficUIController
from Prefab into the current scene.To use drag-and-drop function powered by TouchScript
TouchManager
to the Hierarchy.Cursors
to the Hierarchy to display when tap, mainly for debugging, should not be included in the final beta build.Standard Layer
Component toMain Camer
in the scene, in most cases, just enableHit 3D Objects
for interaction with 3D GameObject. Enabling all of them may result in failing to detect the actual object the cursor is hitting.Transformer
,Transform Gesture
, and aCollider
. In our case, please only enableTranslation
in theTransform Type
inTransform Gesture
and remain other settings unchanged.DraggableTrafficSign.cs
in our project, or view https://github.com/TouchScript/TouchScript/wiki/Examples or https://github.com/TouchScript/TouchScript/wiki/Gestures.To use traffic sign mechanic
Player1_TrafficSignLibrary
andPlayer2_TrafficSignLibrary
fromPlayScnene_TrafficRule
scene to your scene.TrafficSignHolder
script as a component to it.StandingSign_xxx
in thePrefabs
folder, it will automatically take effect for all scenes.StandingTrafficSign.cs
proper blocks (I've already addedTODO
keywords).Summary
Resources
Functionalities
TrafficSignHolder
component. (will calculate the closest one, seeDraggableTrafficSign.cs
for details)DraggableTrafficSign.cs
for details).TerrainFlat
prefab. We may discuss the implementation details later @YuehCorazonScene Modification
Map00
block withTerrainStartingBlock
prefab.Map22
block withTerrainFinishBlock
prefab.