Add Robot Animation

ThingsThatWork_2
Thanh 1 year ago
commit 6259df0e68

@ -46,6 +46,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Name: {fileID: 2155252081681785822} Name: {fileID: 2155252081681785822}
Val: 0
--- !u!1 &3022990752737702646 --- !u!1 &3022990752737702646
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -384,7 +385,9 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
CurrentAction: 0 CurrentAction: 0
TimeRotation: 0 TimeRotation: 0
AngleRotation: -0.1 AngleRotation: -160
TimePassed: 0
SumAngleRotate: 0
DoorIsMoving: 0 DoorIsMoving: 0
--- !u!1 &7115776030973179702 --- !u!1 &7115776030973179702
GameObject: GameObject:
@ -397,7 +400,6 @@ GameObject:
- component: {fileID: 2754178639470773891} - component: {fileID: 2754178639470773891}
- component: {fileID: 4448167961109024055} - component: {fileID: 4448167961109024055}
- component: {fileID: 1694139564342029656} - component: {fileID: 1694139564342029656}
- component: {fileID: 1574267693367435642}
m_Layer: 0 m_Layer: 0
m_Name: Cabinet m_Name: Cabinet
m_TagString: Untagged m_TagString: Untagged
@ -638,6 +640,10 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: Cabinet value: Cabinet
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5298247443101524516, guid: fc03c732175eadc47933eb633f615c6b, type: 3}
propertyPath: AngleRotation
value: -160
objectReference: {fileID: 0}
- target: {fileID: 5556232703678627886, guid: fc03c732175eadc47933eb633f615c6b, type: 3} - target: {fileID: 5556232703678627886, guid: fc03c732175eadc47933eb633f615c6b, type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 0 value: 0
@ -685,24 +691,5 @@ PrefabInstance:
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: m_AddedComponents: []
- targetCorrespondingSourceObject: {fileID: 5066660185504488084, guid: fc03c732175eadc47933eb633f615c6b, type: 3}
insertIndex: -1
addedObject: {fileID: 1574267693367435642}
m_SourcePrefab: {fileID: 100100000, guid: fc03c732175eadc47933eb633f615c6b, type: 3} m_SourcePrefab: {fileID: 100100000, guid: fc03c732175eadc47933eb633f615c6b, type: 3}
--- !u!114 &1574267693367435642
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7115776030973179702}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ed4044aee80d39a4fa934c51059b8e5d, type: 3}
m_Name:
m_EditorClassIdentifier:
CurrentAction: 0
TimeRotation: 0
AngleRotation: -0.1
DoorIsMoving: 0

@ -9,12 +9,12 @@ public class DoorAnimation : MonoBehaviour
[SerializeField] [SerializeField]
public int CurrentAction = 0; public int CurrentAction = 0;
public int TimeRotation = 0; public int TimeRotation = 0;
public float AngleRotation = -0.1f; public float AngleRotation = -160.0f, TimePassed = 0.0f;
public bool DoorIsMoving = false; public bool DoorIsMoving = false;
void Start() void Start()
{ {
} }
public void OpenDoor() { public void OpenDoor() {
@ -29,27 +29,31 @@ public class DoorAnimation : MonoBehaviour
void Update() void Update()
{ {
if(CurrentAction == 1) { if(CurrentAction == 1) {
if(TimeRotation < 900) { if(TimePassed < 1.0f) {
TimeRotation += 1; float NewTime = Mathf.Min(1.0f - TimePassed, Time.deltaTime);
float AngleRotate = AngleRotation * NewTime;
transform.Rotate(0, 0, AngleRotate);
TimePassed += NewTime;
DoorIsMoving = true; DoorIsMoving = true;
transform.Rotate(0, 0, AngleRotation);
} }
else { else {
DoorIsMoving = false; DoorIsMoving = false;
CurrentAction = 0; CurrentAction = 0;
TimeRotation = 0; TimePassed = 0.0f;
} }
} }
else if(CurrentAction == 2) { else if(CurrentAction == 2) {
if(TimeRotation < 900) { if(TimePassed < 1.0f) {
TimeRotation += 1; float NewTime = Mathf.Min(1.0f - TimePassed, Time.deltaTime);
float AngleRotate = -AngleRotation * NewTime;
transform.Rotate(0, 0, AngleRotate);
TimePassed += NewTime;
DoorIsMoving = true; DoorIsMoving = true;
transform.Rotate(0, 0, -AngleRotation);
} }
else { else {
DoorIsMoving = false; DoorIsMoving = false;
CurrentAction = 0; CurrentAction = 0;
TimeRotation = 0; TimePassed = 0.0f;
} }
} }
} }

@ -89,7 +89,6 @@ public class Initalize : MonoBehaviour
void Op901() { void Op901() {
// Code to summon number from Input Bracket // Code to summon number from Input Bracket
Debug.Log(AllInput.Peek() + " and " + AllInput.Count);
AllOperation.Enqueue(Cope(100, AllInput.Peek(), 0)); AllOperation.Enqueue(Cope(100, AllInput.Peek(), 0));
FakeAccumulator = AllInput.Peek(); AllInput.Dequeue(); FakeAccumulator = AllInput.Peek(); AllInput.Dequeue();
} }
@ -143,6 +142,8 @@ public class Initalize : MonoBehaviour
int[] EncodeOperation = new int[100]; int[] EncodeOperation = new int[100];
int InstructionLength = InstructionText.Length, Counter = 0; int InstructionLength = InstructionText.Length, Counter = 0;
for(int i = 0; i < InstructionLength - 2; i += 4) { for(int i = 0; i < InstructionLength - 2; i += 4) {
while(i < InstructionLength && !CheckDigit(InstructionText[i]))
++i;
EncodeOperation[Counter] = Convert.ToInt32(InstructionText.Substring(i, 3)); EncodeOperation[Counter] = Convert.ToInt32(InstructionText.Substring(i, 3));
Counter += 1; Counter += 1;
} }
@ -199,7 +200,7 @@ public class Initalize : MonoBehaviour
if(ActionChange == 1) Door[IndexChange].OpenDoor(); if(ActionChange == 1) Door[IndexChange].OpenDoor();
else Door[IndexChange].CloseDoor(); else Door[IndexChange].CloseDoor();
} }
if(Door[IndexChange].TimeRotation == 900) { if(Door[IndexChange].TimePassed >= 1.0f) {
ActionExisted = false; ActionExisted = false;
IndexChange = -1; IndexChange = -1;
ActionChange = -1; ActionChange = -1;
@ -237,4 +238,8 @@ public class Initalize : MonoBehaviour
} }
} }
} }
void LateUpdate() {
}
} }

@ -1324,7 +1324,11 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 17da3fd4e0129f5449ca3ef38c7c6467, type: 3} - target: {fileID: -8679921383154817045, guid: 17da3fd4e0129f5449ca3ef38c7c6467, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
<<<<<<< HEAD
value: 60 value: 60
=======
value: 66.8
>>>>>>> b04abe1cd99255e43bafd2bc3dd46ef3f1205d84
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 17da3fd4e0129f5449ca3ef38c7c6467, type: 3} - target: {fileID: -8679921383154817045, guid: 17da3fd4e0129f5449ca3ef38c7c6467, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
@ -4755,14 +4759,14 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225} m_GameObject: {fileID: 963194225}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0.09587541, y: 0.24321201, z: -0.02416578, w: 0.9649207}
m_LocalPosition: {x: 71.8, y: 49.9, z: -145.6} m_LocalPosition: {x: -12, y: 19.4, z: -38.9}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 11.349, y: 28.294, z: 0}
--- !u!1001 &966064722 --- !u!1001 &966064722
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save