Ajout d'un cycle jour nuit

la durée du jour et de la nuit est entièrement modifiable depuis les paramètre dans le game object day_controller. s

Correction du bug du précédent commit.
This commit is contained in:
Romain Pellé 2015-01-22 01:26:08 +01:00
parent 15698eebb4
commit 5edd46e20e
9 changed files with 297 additions and 125 deletions

View File

@ -34,7 +34,7 @@ Transition:
m_PrefabInternal: {fileID: 0}
m_Name:
m_SrcState: {fileID: 110206034}
m_DstState: {fileID: 110205094}
m_DstState: {fileID: 110200000}
m_TransitionDuration: .100000001
m_TransitionOffset: 0
m_Conditions:
@ -46,27 +46,7 @@ Transition:
m_Solo: 0
m_Mute: 0
m_CanTransitionToSelf: 0
--- !u!1101 &110139902
Transition:
serializedVersion: 2
m_ObjectHideFlags: 3
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_SrcState: {fileID: 110205094}
m_DstState: {fileID: 110200000}
m_TransitionDuration: .100000001
m_TransitionOffset: 0
m_Conditions:
- m_ConditionMode: 5
m_ConditionEvent: day_status
m_EventTreshold: 0
m_ExitTime: .899999976
m_Atomic: 1
m_Solo: 0
m_Mute: 0
m_CanTransitionToSelf: 0
--- !u!1101 &110145842
--- !u!1101 &110119981
Transition:
serializedVersion: 2
m_ObjectHideFlags: 3
@ -74,31 +54,11 @@ Transition:
m_PrefabInternal: {fileID: 0}
m_Name:
m_SrcState: {fileID: 110200000}
m_DstState: {fileID: 110297379}
m_TransitionDuration: .100000001
m_TransitionOffset: 0
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: day_status
m_EventTreshold: 0
m_ExitTime: .899999976
m_Atomic: 1
m_Solo: 0
m_Mute: 0
m_CanTransitionToSelf: 0
--- !u!1101 &110179087
Transition:
serializedVersion: 2
m_ObjectHideFlags: 3
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_SrcState: {fileID: 110297379}
m_DstState: {fileID: 110206034}
m_TransitionDuration: .100000001
m_TransitionOffset: 0
m_Conditions:
- m_ConditionMode: 5
- m_ConditionMode: 6
m_ConditionEvent: day_status
m_EventTreshold: 0
m_ExitTime: .899999976
@ -115,24 +75,9 @@ State:
m_Speed: 1
m_CycleOffset: 0
m_Motions:
- {fileID: 0}
- {fileID: 7400000, guid: df5cb0d3151acfa45a800c250ea2c5da, type: 2}
m_ParentStateMachine: {fileID: 110700000}
m_Position: {x: 264, y: 204, z: 0}
m_IKOnFeet: 0
m_Mirror: 0
m_Tag:
--- !u!1102 &110205094
State:
m_ObjectHideFlags: 3
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: D/N
m_Speed: 1
m_CycleOffset: 0
m_Motions:
- {fileID: 0}
m_ParentStateMachine: {fileID: 110700000}
m_Position: {x: 480, y: 36, z: 0}
m_Position: {x: 264, y: 72, z: 0}
m_IKOnFeet: 0
m_Mirror: 0
m_Tag:
@ -142,30 +87,15 @@ State:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Day
m_Speed: 1
m_Speed: -1
m_CycleOffset: 0
m_Motions:
- {fileID: 0}
- {fileID: 7400000, guid: df5cb0d3151acfa45a800c250ea2c5da, type: 2}
m_ParentStateMachine: {fileID: 110700000}
m_Position: {x: 264, y: -120, z: 0}
m_IKOnFeet: 0
m_Mirror: 0
m_Tag:
--- !u!1102 &110297379
State:
m_ObjectHideFlags: 3
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: N/D
m_Speed: 1
m_CycleOffset: 0
m_Motions:
- {fileID: 0}
m_ParentStateMachine: {fileID: 110700000}
m_Position: {x: 48, y: 36, z: 0}
m_IKOnFeet: 0
m_Mirror: 0
m_Tag:
--- !u!1107 &110700000
StateMachine:
serializedVersion: 2
@ -177,27 +107,23 @@ StateMachine:
m_States:
- {fileID: 110200000}
- {fileID: 110206034}
- {fileID: 110205094}
- {fileID: 110297379}
m_ChildStateMachine: []
m_ChildStateMachinePosition: []
m_OrderedTransitions:
data:
first: {fileID: 110297379}
first: {fileID: 110200000}
second:
- {fileID: 110179087}
- {fileID: 110119981}
data:
first: {fileID: 110205094}
second:
- {fileID: 110139902}
first: {fileID: 0}
second: []
data:
first: {fileID: 110206034}
second:
- {fileID: 110100000}
data:
first: {fileID: 110200000}
second:
- {fileID: 110145842}
first: {fileID: 0}
second: []
m_MotionSetCount: 1
m_AnyStatePosition: {x: 696, y: -216, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}

View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: d23948a429c890c498ceb027bcd5fa34
folderAsset: yes
DefaultImporter:
userData:

View File

@ -0,0 +1,178 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: daytonight
serializedVersion: 4
m_AnimationType: 2
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves:
- curve:
serializedVersion: 2
m_Curve:
- time: .13333334
value: .0500000007
inSlope: -.111111119
outSlope: -.111111119
tangentMode: 10
- time: .583333313
value: 0
inSlope: -.111111119
outSlope: -.111111119
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_Intensity
path: Area Light
classID: 108
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- time: 0
value: .439999998
inSlope: -.754285753
outSlope: -.754285753
tangentMode: 10
- time: .583333313
value: 0
inSlope: -.754285753
outSlope: -.754285753
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_Intensity
path: SunLight
classID: 108
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- time: .283333331
value: 0
inSlope: 1.4000001
outSlope: 1.4000001
tangentMode: 10
- time: .583333313
value: .419999987
inSlope: 1.4000001
outSlope: 1.4000001
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_Intensity
path: MoonLight
classID: 108
script: {fileID: 0}
m_PPtrCurves: []
m_SampleRate: 60
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- path: 2453178349
attribute: 898800009
script: {fileID: 0}
classID: 108
customType: 0
isPPtrCurve: 0
- path: 1591492100
attribute: 898800009
script: {fileID: 0}
classID: 108
customType: 0
isPPtrCurve: 0
- path: 3823539233
attribute: 898800009
script: {fileID: 0}
classID: 108
customType: 0
isPPtrCurve: 0
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_StartTime: 0
m_StopTime: .583333313
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves:
- curve:
serializedVersion: 2
m_Curve:
- time: .13333334
value: .0500000007
inSlope: -.111111119
outSlope: -.111111119
tangentMode: 10
- time: .583333313
value: 0
inSlope: -.111111119
outSlope: -.111111119
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_Intensity
path: Area Light
classID: 108
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- time: 0
value: .439999998
inSlope: -.754285753
outSlope: -.754285753
tangentMode: 10
- time: .583333313
value: 0
inSlope: -.754285753
outSlope: -.754285753
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_Intensity
path: SunLight
classID: 108
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- time: .283333331
value: 0
inSlope: 1.4000001
outSlope: 1.4000001
tangentMode: 10
- time: .583333313
value: .419999987
inSlope: 1.4000001
outSlope: 1.4000001
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_Intensity
path: MoonLight
classID: 108
script: {fileID: 0}
m_EulerEditorCurves: []
m_Events: []

View File

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: df5cb0d3151acfa45a800c250ea2c5da
NativeFormatImporter:
userData:

View File

@ -2613,7 +2613,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!108 &161992412
Light:
m_ObjectHideFlags: 0
@ -2656,11 +2656,11 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 161992411}
m_LocalRotation: {x: .420340389, y: .16219382, z: .0766497999, w: .889456034}
m_LocalPosition: {x: -25.1069031, y: 90.2603149, z: 109.107849}
m_LocalPosition: {x: -154.265503, y: 635.286255, z: -597.690674}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2082661559}
m_RootOrder: 2
m_Father: {fileID: 2130265912}
m_RootOrder: 0
--- !u!1 &163194936
GameObject:
m_ObjectHideFlags: 0
@ -7906,7 +7906,7 @@ Transform:
- {fileID: 363748264}
- {fileID: 1367076073}
m_Father: {fileID: 2082661559}
m_RootOrder: 8
m_RootOrder: 5
--- !u!1 &578926050
GameObject:
m_ObjectHideFlags: 0
@ -12201,7 +12201,7 @@ Transform:
- {fileID: 828187915}
- {fileID: 1894284579}
m_Father: {fileID: 2082661559}
m_RootOrder: 7
m_RootOrder: 4
--- !u!1 &948892945
GameObject:
m_ObjectHideFlags: 0
@ -17251,7 +17251,7 @@ Transform:
- {fileID: 1880431846}
- {fileID: 717116040}
m_Father: {fileID: 2082661559}
m_RootOrder: 5
m_RootOrder: 2
--- !u!1 &1364751245
GameObject:
m_ObjectHideFlags: 0
@ -18554,7 +18554,7 @@ Transform:
- {fileID: 1868011519}
- {fileID: 961916967}
m_Father: {fileID: 2082661559}
m_RootOrder: 6
m_RootOrder: 3
--- !u!1 &1443112309
GameObject:
m_ObjectHideFlags: 0
@ -23447,6 +23447,7 @@ GameObject:
- 222: {fileID: 1755274889}
- 114: {fileID: 1755274888}
- 114: {fileID: 1755274887}
- 95: {fileID: 1755274890}
m_Layer: 5
m_Name: Clock_1
m_TagString: Untagged
@ -23511,6 +23512,21 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1755274885}
--- !u!95 &1755274890
Animator:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1755274885}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: 44ff74f56ed3a05429ff08e46f7f19e9, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 1
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
--- !u!1 &1765856480
GameObject:
m_ObjectHideFlags: 0
@ -24331,7 +24347,7 @@ Transform:
- {fileID: 1731313763}
- {fileID: 377466160}
m_Father: {fileID: 2082661559}
m_RootOrder: 9
m_RootOrder: 6
--- !u!1 &1826980348
GameObject:
m_ObjectHideFlags: 0
@ -25638,13 +25654,14 @@ GameObject:
m_Component:
- 4: {fileID: 1911482243}
- 108: {fileID: 1911482242}
- 95: {fileID: 1911482244}
m_Layer: 0
m_Name: SunLight
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!108 &1911482242
Light:
m_ObjectHideFlags: 0
@ -25686,12 +25703,27 @@ Transform:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1911482241}
m_LocalRotation: {x: .408217937, y: -.234569728, z: .109381661, w: .875426114}
m_LocalPosition: {x: -174.516907, y: 53.9313126, z: 305.537842}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalRotation: {x: .766789556, y: -.0813384652, z: -.000418142678, w: .636724234}
m_LocalPosition: {x: -580.026855, y: 1222.80151, z: -305.23233}
m_LocalScale: {x: .99999994, y: 1.00000024, z: 1.00000024}
m_Children: []
m_Father: {fileID: 2082661559}
m_RootOrder: 3
m_Father: {fileID: 2130265912}
m_RootOrder: 1
--- !u!95 &1911482244
Animator:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1911482241}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: 548d6b7a41c1dd74dbc74a2d39d37e62, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 1
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
--- !u!1 &1914139196
GameObject:
m_ObjectHideFlags: 0
@ -27255,7 +27287,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!114 &2022993158
MonoBehaviour:
m_ObjectHideFlags: 0
@ -27272,7 +27304,6 @@ MonoBehaviour:
contentPanel: {fileID: 1593353186}
portrait: {fileID: 235015811}
scrollrect: {fileID: 737082149}
myfield: {fileID: 52053180}
--- !u!4 &2022993159
Transform:
m_ObjectHideFlags: 0
@ -27700,6 +27731,7 @@ GameObject:
m_Component:
- 4: {fileID: 2047370601}
- 108: {fileID: 2047370602}
- 95: {fileID: 2047370603}
m_Layer: 0
m_Name: MoonLight
m_TagString: Untagged
@ -27714,11 +27746,11 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2047370600}
m_LocalRotation: {x: .408217996, y: -.234569997, z: .109382004, w: .875425994}
m_LocalPosition: {x: -174.516907, y: 53.9313126, z: 305.537842}
m_LocalScale: {x: 1, y: 1, z: 1.00000012}
m_LocalPosition: {x: -303.675507, y: 598.957275, z: -401.260651}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2082661559}
m_RootOrder: 4
m_Father: {fileID: 2130265912}
m_RootOrder: 2
--- !u!108 &2047370602
Light:
m_ObjectHideFlags: 0
@ -27729,7 +27761,7 @@ Light:
serializedVersion: 3
m_Type: 1
m_Color: {r: .149167374, g: .215371773, b: .654411793, a: 1}
m_Intensity: .419999987
m_Intensity: 0
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
@ -27754,6 +27786,21 @@ Light:
m_ShadowAngle: 0
m_IndirectIntensity: 1
m_AreaSize: {x: 1, y: 1}
--- !u!95 &2047370603
Animator:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2047370600}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: 85b3c5b648ccb754684810e87934a17a, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 1
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
--- !u!1 &2058035366
GameObject:
m_ObjectHideFlags: 0
@ -28298,9 +28345,6 @@ Transform:
m_Children:
- {fileID: 1753276986}
- {fileID: 1859570690}
- {fileID: 161992413}
- {fileID: 1911482243}
- {fileID: 2047370601}
- {fileID: 1361733863}
- {fileID: 1437703998}
- {fileID: 948211392}
@ -28465,7 +28509,10 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 303.675507, y: -598.957275, z: 401.260651}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Children:
- {fileID: 161992413}
- {fileID: 1911482243}
- {fileID: 2047370601}
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!114 &2130265913
@ -28476,12 +28523,12 @@ MonoBehaviour:
m_GameObject: {fileID: 2130265910}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f835c976f46f244f92d17940e11a552, type: 3}
m_Script: {fileID: 11500000, guid: e4e706d96762faf4bad01887dd321410, type: 3}
m_Name:
m_EditorClassIdentifier:
machine: {fileID: 2130265911}
maxDay: 30
maxNight: 20
maxDay: 15
maxNight: 10
--- !u!1 &2136149714
GameObject:
m_ObjectHideFlags: 0

View File

@ -1,13 +1,23 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Clock : MonoBehaviour {
public GameObject clock;
GameObject day_controller;
DayController daycontroller;
int maxDay;
int maxNight;
// Use this for initialization
void Start () {
day_controller = GameObject.Find ("day_controller");
daycontroller = day_controller.GetComponent<DayController> ();
maxDay = daycontroller.maxDay;
maxNight = daycontroller.maxNight;
}
// Update is called once per frame
@ -18,10 +28,10 @@ public class Clock : MonoBehaviour {
float fRot = clock.transform.rotation.z;
if(fRot>=0 && fRot<180){
clock.transform.Rotate(0, 0, (float)(Time.deltaTime * (-180.0)/150.0));//2.5min
clock.transform.Rotate(0, 0, (float)(Time.deltaTime * (-180.0)/maxDay));//2.5min
}
else{
clock.transform.Rotate(0, 0, (float)(Time.deltaTime * (-180.0)/60.0));//1min
clock.transform.Rotate(0, 0, (float)(Time.deltaTime * (-180.0)/maxNight));//1min
}
}
}

View File

@ -19,7 +19,7 @@ public class CreateScrollList : MonoBehaviour {
public Transform contentPanel;
public Image portrait;
public ScrollRect scrollrect;
public InputField myfield;
//public InputField myfield;
GameObject chat_input;
TchatAnim tchatAnim;
string message_old;

View File

@ -1,7 +1,7 @@
using UnityEngine;
using System.Collections;
public class day_controller : MonoBehaviour {
public class DayController : MonoBehaviour {
public Animator machine;
public int maxDay;
@ -18,11 +18,12 @@ public class day_controller : MonoBehaviour {
void Update () {
if (machine.GetInteger("day_status")==0){
print("il fait jour");
if (timer >= (float)maxDay-1){
if (timer >= (float)maxDay){
timer =0;
machine.SetInteger("day_status",1);
print("il fait nuit");
}
else{
@ -32,11 +33,12 @@ public class day_controller : MonoBehaviour {
}
if (machine.GetInteger("day_status")==1){
print("il fait nuit");
if (timer >= (float)maxNight-1){
if (timer >= (float)maxNight){
timer =0;
machine.SetInteger("day_status",0);
print("il fait jour");
}
else{

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4f835c976f46f244f92d17940e11a552
guid: e4e706d96762faf4bad01887dd321410
MonoImporter:
serializedVersion: 2
defaultReferences: []