Skip to content

Commit ce481ff

Browse files
committed
add more demos
1 parent 852bf9a commit ce481ff

40 files changed

+4617
-297
lines changed

Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ MonoBehaviour:
2525
m_Address: Character_AddressPool_P01
2626
m_ReadOnly: 0
2727
m_SerializedLabels: []
28+
- m_GUID: 5fa68afe6708644fda728daf092224b3
29+
m_Address: Character_AddressPool_P02
30+
m_ReadOnly: 0
31+
m_SerializedLabels: []
2832
m_ReadOnly: 0
2933
m_Settings: {fileID: 11400000, guid: e0f6fa325fd1a464cbecb4e3b9f30872, type: 2}
3034
m_SchemaSet:
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,35 @@
11
%YAML 1.1
22
%TAG !u! tag:unity3d.com,2011:
3-
--- !u!1102 &-9133244317985967505
3+
--- !u!91 &9100000
4+
AnimatorController:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_Name: JumpAnimator
10+
serializedVersion: 5
11+
m_AnimatorParameters: []
12+
m_AnimatorLayers:
13+
- serializedVersion: 5
14+
m_Name: Base Layer
15+
m_StateMachine: {fileID: 4796630309060929313}
16+
m_Mask: {fileID: 0}
17+
m_Motions: []
18+
m_Behaviours: []
19+
m_BlendingMode: 0
20+
m_SyncedLayerIndex: -1
21+
m_DefaultWeight: 0
22+
m_IKPass: 0
23+
m_SyncedLayerAffectsTiming: 0
24+
m_Controller: {fileID: 9100000}
25+
--- !u!1102 &241672152774964924
426
AnimatorState:
527
serializedVersion: 6
628
m_ObjectHideFlags: 1
729
m_CorrespondingSourceObject: {fileID: 0}
830
m_PrefabInstance: {fileID: 0}
931
m_PrefabAsset: {fileID: 0}
10-
m_Name: JumpAir
32+
m_Name: Victory01
1133
m_Speed: 1
1234
m_CycleOffset: 0
1335
m_Transitions: []
@@ -20,34 +42,12 @@ AnimatorState:
2042
m_MirrorParameterActive: 0
2143
m_CycleOffsetParameterActive: 0
2244
m_TimeParameterActive: 0
23-
m_Motion: {fileID: 7400000, guid: 0963d8d4ee9c2e746a851650bce38837, type: 3}
45+
m_Motion: {fileID: 7400000, guid: 638b1d8fb5dd82245b382272af09c8a0, type: 3}
2446
m_Tag:
2547
m_SpeedParameter:
2648
m_MirrorParameter:
2749
m_CycleOffsetParameter:
2850
m_TimeParameter:
29-
--- !u!91 &9100000
30-
AnimatorController:
31-
m_ObjectHideFlags: 0
32-
m_CorrespondingSourceObject: {fileID: 0}
33-
m_PrefabInstance: {fileID: 0}
34-
m_PrefabAsset: {fileID: 0}
35-
m_Name: JumpAnimator
36-
serializedVersion: 5
37-
m_AnimatorParameters: []
38-
m_AnimatorLayers:
39-
- serializedVersion: 5
40-
m_Name: Base Layer
41-
m_StateMachine: {fileID: 4796630309060929313}
42-
m_Mask: {fileID: 0}
43-
m_Motions: []
44-
m_Behaviours: []
45-
m_BlendingMode: 0
46-
m_SyncedLayerIndex: -1
47-
m_DefaultWeight: 0
48-
m_IKPass: 0
49-
m_SyncedLayerAffectsTiming: 0
50-
m_Controller: {fileID: 9100000}
5151
--- !u!1107 &4796630309060929313
5252
AnimatorStateMachine:
5353
serializedVersion: 6
@@ -58,8 +58,8 @@ AnimatorStateMachine:
5858
m_Name: Base Layer
5959
m_ChildStates:
6060
- serializedVersion: 1
61-
m_State: {fileID: -9133244317985967505}
62-
m_Position: {x: 402.26514, y: 103.368286, z: 0}
61+
m_State: {fileID: 241672152774964924}
62+
m_Position: {x: 513.6363, y: 51.818176, z: 0}
6363
m_ChildStateMachines: []
6464
m_AnyStateTransitions: []
6565
m_EntryTransitions: []
@@ -69,4 +69,4 @@ AnimatorStateMachine:
6969
m_EntryPosition: {x: 50, y: 120, z: 0}
7070
m_ExitPosition: {x: 800, y: 120, z: 0}
7171
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
72-
m_DefaultState: {fileID: -9133244317985967505}
72+
m_DefaultState: {fileID: 241672152774964924}

Assets/Characters/Prefabs/P01.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2753,7 +2753,7 @@ Transform:
27532753
m_GameObject: {fileID: 8597698371886135454}
27542754
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
27552755
m_LocalPosition: {x: 0, y: 0, z: 0}
2756-
m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
2756+
m_LocalScale: {x: 1, y: 1, z: 1}
27572757
m_ConstrainProportionsScale: 0
27582758
m_Children:
27592759
- {fileID: 2512636479863327776}

Assets/Characters/Prefabs/P02.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,7 @@ Transform:
17641764
m_GameObject: {fileID: 5535647646396653931}
17651765
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
17661766
m_LocalPosition: {x: 0, y: 0, z: 0}
1767-
m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
1767+
m_LocalScale: {x: 1, y: 1, z: 1}
17681768
m_ConstrainProportionsScale: 0
17691769
m_Children:
17701770
- {fileID: 1827642009972118997}

Assets/Environment/Scripts.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Environment/Scripts/Grid.cs

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
using System;
2+
using UnityEngine;
3+
using ZBase.Collections.Pooled.Generic;
4+
5+
namespace Sample.Environment
6+
{
7+
public class Grid
8+
{
9+
private List<Slot> _slots = new List<Slot>();
10+
11+
public Grid(int width, int height)
12+
{
13+
for (int x = -width; x < width; x++)
14+
{
15+
for (int y = -height; y < height; y++)
16+
{
17+
_slots.Add(new Slot(new Vector3(x, 0, y), false));
18+
}
19+
}
20+
}
21+
22+
public Grid(int width, int height, bool odd)
23+
{
24+
for (int x = -width; x < width; x++)
25+
{
26+
if (odd)
27+
{
28+
if (x % 2 == 0)
29+
continue;
30+
}
31+
else
32+
{
33+
if (x % 2 != 0)
34+
continue;
35+
}
36+
37+
for (int y = -height; y < height; y++)
38+
{
39+
if (odd)
40+
{
41+
if (y % 2 == 0)
42+
continue;
43+
}
44+
else
45+
{
46+
if (y % 2 != 0)
47+
continue;
48+
}
49+
50+
_slots.Add(new Slot(new Vector3(x, 0, y), false));
51+
}
52+
}
53+
}
54+
55+
public Slot GetAvailableSlot()
56+
{
57+
for (int i = 0; i < this._slots.Count; i++)
58+
{
59+
if (!this._slots[i].isOccupied)
60+
{
61+
var newSlot = this._slots[i];
62+
newSlot.isOccupied = true;
63+
this._slots[i] = newSlot;
64+
return this._slots[i];
65+
}
66+
}
67+
68+
throw new Exception("No available slot");
69+
}
70+
71+
public Slot FreeSlot(Vector3 position)
72+
{
73+
foreach (var slot in this._slots)
74+
{
75+
if (slot.position == position)
76+
{
77+
var newSlot = slot;
78+
newSlot.isOccupied = false;
79+
this._slots[this._slots.IndexOf(slot)] = newSlot;
80+
return slot;
81+
}
82+
}
83+
84+
throw new Exception("No available slot");
85+
}
86+
}
87+
}

Assets/Environment/Scripts/Grid.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "Sample.Environment",
3+
"rootNamespace": "Sample.Environment",
4+
"references": [
5+
"ZBase.Collections.Pooled"
6+
],
7+
"includePlatforms": [],
8+
"excludePlatforms": [],
9+
"allowUnsafeCode": true,
10+
"overrideReferences": false,
11+
"precompiledReferences": [],
12+
"autoReferenced": true,
13+
"defineConstraints": [],
14+
"versionDefines": [],
15+
"noEngineReferences": false
16+
}

Assets/Environment/Scripts/Sample.Environment.asmdef.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Environment/Scripts/Slot.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using UnityEngine;
2+
3+
namespace Sample.Environment
4+
{
5+
public struct Slot
6+
{
7+
public Vector3 position;
8+
public bool isOccupied;
9+
10+
public Slot(Vector3 position, bool isOccupied)
11+
{
12+
this.position = position;
13+
this.isOccupied = isOccupied;
14+
}
15+
16+
public void Occupy()
17+
{
18+
isOccupied = true;
19+
}
20+
21+
public void Free()
22+
{
23+
isOccupied = false;
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)