dynamic tongue & new/improved faces

This commit is contained in:
spatialfree 2020-10-01 19:20:21 -07:00
parent 1ba1676d0e
commit 1fe84a8501
8 changed files with 186 additions and 16 deletions

View file

@ -1748,7 +1748,7 @@ MonoBehaviour:
boxShake: {x: 0, y: 0, z: 0} boxShake: {x: 0, y: 0, z: 0}
boxOffset: {x: 0, y: 0, z: 0} boxOffset: {x: 0, y: 0, z: 0}
ready: 0 ready: 0
alignRecordCam: 1 alignRecordCam: 0
--- !u!1 &434999704 --- !u!1 &434999704
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2766,7 +2766,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!224 &719007412 --- !u!224 &719007412
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3168,11 +3168,11 @@ Camera:
far clip plane: 100 far clip plane: 100
field of view: 60 field of view: 60
orthographic: 1 orthographic: 1
orthographic size: 10 orthographic size: 6
m_Depth: 1 m_Depth: 1
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 311
m_RenderingPath: -1 m_RenderingPath: -1
m_TargetTexture: {fileID: 0} m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0 m_TargetDisplay: 0
@ -7393,6 +7393,7 @@ MonoBehaviour:
metro: {fileID: 408032442} metro: {fileID: 408032442}
rig: {fileID: 416451007} rig: {fileID: 416451007}
boxUI: {fileID: 1510915029} boxUI: {fileID: 1510915029}
tongueLine: {fileID: 1821719419}
graphXData: {fileID: 11400000, guid: a2a60279d0f57e841b54091e749bdccb, type: 2} graphXData: {fileID: 11400000, guid: a2a60279d0f57e841b54091e749bdccb, type: 2}
soundData: {fileID: 11400000, guid: 4e7fe59e4863c834fbf8ed54655e2385, type: 2} soundData: {fileID: 11400000, guid: 4e7fe59e4863c834fbf8ed54655e2385, type: 2}
loopSource: {fileID: 408032440} loopSource: {fileID: 408032440}
@ -7463,6 +7464,132 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1821719418
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1821719420}
- component: {fileID: 1821719419}
m_Layer: 0
m_Name: Tongue
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!120 &1821719419
LineRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1821719418}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10306, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: 0, y: 0, z: 1}
m_Parameters:
serializedVersion: 3
widthMultiplier: 0.1
widthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
colorGradient:
serializedVersion: 2
key0: {r: 1, g: 0.627451, b: 1, a: 1}
key1: {r: 0.9811321, g: 0.5322179, b: 0.64302593, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 2
m_NumAlphaKeys: 2
numCornerVertices: 0
numCapVertices: 0
alignment: 0
textureMode: 0
shadowBias: 0.5
generateLightingData: 0
m_UseWorldSpace: 0
m_Loop: 0
--- !u!4 &1821719420
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1821719418}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1825209466 --- !u!1 &1825209466
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View file

@ -63,13 +63,28 @@ public class GraphX
foodScale * Vector3.one foodScale * Vector3.one
); Graphics.DrawMesh(data.foodMesh, foodMatrix, data.snakeMat, 0); ); Graphics.DrawMesh(data.foodMesh, foodMatrix, data.snakeMat, 0);
if (main.playing && (data.faceMesh == data.faceDefault || data.faceMesh == data.faceEaten)) if (main.playing && (data.faceMesh == data.faceDefault || data.faceEaten || data.faceHyper))
{ {
tongueMatrix.SetTRS( // tongueMatrix.SetTRS(
main.snake[0], // main.snake[0],
main.inputRot, // main.inputRot,
Vector3.one // Vector3.one
); Graphics.DrawMesh(data.tongueMesh, tongueMatrix, data.snakeMat, 0); // ); Graphics.DrawMesh(data.tongueMesh, tongueMatrix, data.snakeMat, 0);
main.tongueLine.SetPosition(0, main.snake[0] + ((Vector3)main.dir * 0.4f));
Vector3 tip = main.snake[0] + main.inputRot * Vector3.forward * ((1 + Mathf.Clamp01(main.lerp * 3)) / 2);
float x = main.design.bounds.x + 0.5f;
float y = main.design.bounds.y + 0.5f;
float z = main.design.bounds.z + 0.5f;
tip.x = Mathf.Clamp(tip.x, -x, x);
tip.y = Mathf.Clamp(tip.y, -y, y);
tip.z = Mathf.Clamp(tip.z, -z, z);
main.tongueLine.SetPosition(1, tip);
}
else
{
main.tongueLine.SetPosition(0, Vector3.zero);
main.tongueLine.SetPosition(1, Vector3.zero);
} }
if (!main.aiMode && main.playing) if (!main.aiMode && main.playing)

View file

@ -19,7 +19,7 @@ public class GraphXData : ScriptableObject
[Header("Faces")] [Header("Faces")]
public Mesh faceMesh; public Mesh faceMesh;
public Mesh faceDefault, faceEat, faceEaten, faceBump, faceBoxGameover, faceSelfGameover; public Mesh faceDefault, faceEat, faceEaten, faceBump, faceBoxGameover, faceSelfGameover, faceHyper;
[Header("Poof")] [Header("Poof")]
public Mesh poofMesh; public Mesh poofMesh;

View file

@ -24,6 +24,7 @@ public class Main : MonoBehaviour
public AI ai = new AI(); public AI ai = new AI();
public Game game = new Game(); public Game game = new Game();
public BoxUI boxUI; public BoxUI boxUI;
public LineRenderer tongueLine;
public GraphXData graphXData; public GraphXData graphXData;
public GraphX graphX; public GraphX graphX;
@ -79,7 +80,7 @@ public class Main : MonoBehaviour
sfx = new SFX(soundData); sfx = new SFX(soundData);
graphX = new GraphX(graphXData); graphX = new GraphX(graphXData);
snakeFace = new SnakeFace(graphXData); snakeFace = new SnakeFace(this, graphXData);
poof = new Poof(graphXData); poof = new Poof(graphXData);
drip = new Drip(graphXData); drip = new Drip(graphXData);
Game.OnBump += drip.Bump; Game.OnBump += drip.Bump;
@ -163,7 +164,6 @@ public class Main : MonoBehaviour
playing = false; playing = false;
Shader.SetGlobalInt("_Flash", 1); Shader.SetGlobalInt("_Flash", 1);
food = initialFood;
restart++; restart++;
OnReset(); OnReset();
break; break;
@ -177,6 +177,8 @@ public class Main : MonoBehaviour
core = new List<Vector3Int>(initialCore); core = new List<Vector3Int>(initialCore);
dir = new Vector3Int(0, 0, 1); dir = new Vector3Int(0, 0, 1);
food = space[Random.Range(0, space.Count)];
Shader.SetGlobalInt("_Flash", 0); Shader.SetGlobalInt("_Flash", 0);
if (aiMode) if (aiMode)
{ {

View file

@ -2,7 +2,7 @@ using UnityEngine;
public class SnakeFace public class SnakeFace
{ {
public SnakeFace(GraphXData data) public SnakeFace(Main main, GraphXData data)
{ {
Main.OnGameStart += this.GameStart; Main.OnGameStart += this.GameStart;
Main.OnReset += this.Reset; Main.OnReset += this.Reset;
@ -12,9 +12,11 @@ public class SnakeFace
Game.OnBump += this.Bump; Game.OnBump += this.Bump;
Game.OnCrash += this.Crash; Game.OnCrash += this.Crash;
this.main = main;
this.data = data; this.data = data;
} }
Main main;
GraphXData data; GraphXData data;
void GameStart(Main main) void GameStart(Main main)
@ -31,7 +33,14 @@ public class SnakeFace
{ {
if (full > 0) if (full > 0)
{ {
data.faceMesh = data.faceEaten; if (main.fastQueue > 0)
{
data.faceMesh = data.faceHyper;
}
else
{
data.faceMesh = data.faceEaten;
}
} }
else else
{ {
@ -46,7 +55,14 @@ public class SnakeFace
void Eat(Vector3 pos) void Eat(Vector3 pos)
{ {
data.faceMesh = data.faceEaten; if (main.fastQueue > 0)
{
data.faceMesh = data.faceHyper;
}
else
{
data.faceMesh = data.faceEaten;
}
} }
void Bump(Vector3 dir) void Bump(Vector3 dir)

Binary file not shown.

View file

@ -50,6 +50,8 @@ ModelImporter:
100088: FoodOld 100088: FoodOld
100090: Tongue 100090: Tongue
100092: WetBox 100092: WetBox
100094: Face6
100096: Face6Hyper
400000: Arrow 400000: Arrow
400002: //RootNode 400002: //RootNode
400004: Face0Default 400004: Face0Default
@ -97,6 +99,8 @@ ModelImporter:
400088: FoodOld 400088: FoodOld
400090: Tongue 400090: Tongue
400092: WetBox 400092: WetBox
400094: Face6
400096: Face6Hyper
2100000: No Name 2100000: No Name
2300000: Arrow 2300000: Arrow
2300002: Face0Default 2300002: Face0Default
@ -144,6 +148,8 @@ ModelImporter:
2300086: FoodOld 2300086: FoodOld
2300088: Tongue 2300088: Tongue
2300090: WetBox 2300090: WetBox
2300092: Face6
2300094: Face6Hyper
3300000: Arrow 3300000: Arrow
3300002: Face0Default 3300002: Face0Default
3300004: Face1Eat 3300004: Face1Eat
@ -190,6 +196,8 @@ ModelImporter:
3300086: FoodOld 3300086: FoodOld
3300088: Tongue 3300088: Tongue
3300090: WetBox 3300090: WetBox
3300092: Face6
3300094: Face6Hyper
4300000: Arrow 4300000: Arrow
4300002: InsideOut 4300002: InsideOut
4300004: Segment 4300004: Segment
@ -236,6 +244,8 @@ ModelImporter:
4300086: FoodOld 4300086: FoodOld
4300088: Tongue 4300088: Tongue
4300090: WetBox 4300090: WetBox
4300092: Face6
4300094: Face6Hyper
9500000: //RootNode 9500000: //RootNode
2186277476908879412: ImportLogs 2186277476908879412: ImportLogs
externalObjects: {} externalObjects: {}

Binary file not shown.