This commit is contained in:
jparent 2015-08-22 17:03:28 -04:00
commit 0c9796c8c0
61 changed files with 866 additions and 32 deletions

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 35d7b15c1b28c814794cc806cb06a6e9
guid: 20a38383cf02483478e2ec6290ca826a
folderAsset: yes
timeCreated: 1440209531
timeCreated: 1440210034
licenseType: Free
DefaultImporter:
userData:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0c92cbcd5d0adc142b47082933b10684
folderAsset: yes
timeCreated: 1440263099
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 69d3bb142e9e6064083dc07f4eb8a2e8
timeCreated: 1440263099
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d9580703c7aa24d46af0b69d32797918
timeCreated: 1440263100
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2d40c7a9a950ef943b7b5d50a03e8c4e
timeCreated: 1440263099
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Art/SM_Lit.FBX Normal file

Binary file not shown.

View File

@ -0,0 +1,86 @@
fileFormatVersion: 2
guid: c363f2ebb3b0dd940b930163386af1f5
timeCreated: 1440263100
licenseType: Free
ModelImporter:
serializedVersion: 18
fileIDToRecycleName:
100000: Object002
100002: Object003
100004: Object004
100006: //RootNode
400000: Object002
400002: Object003
400004: Object004
400006: //RootNode
2300000: Object002
2300002: Object003
2300004: Object004
3300000: Object002
3300002: Object003
3300004: Object004
4300000: Object002
4300002: Object003
4300004: Object004
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
optimizeGameObjects: 0
motionNodeName:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
animationCompression: 1
animationRotationError: .5
animationPositionError: .5
animationScaleError: .5
animationWrapMode: 0
extraExposedTransformPaths: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
importBlendShapes: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
splitTangentsAcrossUV: 1
normalImportMode: 0
tangentImportMode: 1
importAnimation: 1
copyAvatar: 0
humanDescription:
human: []
skeleton: []
armTwist: .5
foreArmTwist: .5
upperLegTwist: .5
legTwist: .5
armStretch: .0500000007
legStretch: .0500000007
feetSpacing: 0
rootMotionBoneName:
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 8ca9f475852ccb84783c150fd0200c1e
folderAsset: yes
timeCreated: 1440263098
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 KiB

View File

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: 245bd740bec1a1e41b460cb7c1f27974
timeCreated: 1440263098
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 KiB

View File

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: efae273d913dbd940b89144baad4ad3f
timeCreated: 1440263100
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 KiB

View File

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: cc03596f75f893941aa6b96655c176eb
timeCreated: 1440263099
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

9
Assets/Art/Sprites.meta Normal file
View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: ff238c13ee4455348a494b7f8e84b44b
folderAsset: yes
timeCreated: 1440262328
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9264b7464f0b2a04d951cf9fbfef3019
folderAsset: yes
timeCreated: 1440262930
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a982ca76f16291a469a3532007a4cb13
timeCreated: 1440262931
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 11cc80c6443f5ea4190c0041d3858a7e
timeCreated: 1440263521
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: d8eead0b348e6814d877c5d98b8fb4fa
timeCreated: 1440264201
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 1
externalNormalMap: 1
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 2
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: 1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: a2bec7dd3416205468bb86b85886ed6c
timeCreated: 1440264178
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 1
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 2
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: 0
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 53bff6c471c632c4e94ded502d898a72
guid: a1b68b3746563664e96594bbf34c2243
folderAsset: yes
timeCreated: 1440209485
timeCreated: 1440210034
licenseType: Free
DefaultImporter:
userData:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 17f1fb22be4247d4baff3f576a2cb9aa
timeCreated: 1440233010
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 32997c9d92ac99e4aa7f4a0f558d918e
timeCreated: 1440235608
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 875ccc0b27596c84b9faab65d1b2272b
timeCreated: 1440263709
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 70345ee2f2d9f624e99bd686617b43c5
guid: 4173f5218215fc34bb9ee433a1db403f
folderAsset: yes
timeCreated: 1440209479
timeCreated: 1440210034
licenseType: Free
DefaultImporter:
userData:

BIN
Assets/Prefabs/Bed.prefab Normal file

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9f2c38d0d3154bc4d8148a949b98af28
timeCreated: 1440250095
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

BIN
Assets/Prefabs/Floor.prefab Normal file

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 46cbd4a59ec21ba4d8adfffd70146cb7
timeCreated: 1440235651
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 61927a802a14ae2428ecc6b11539bfb0
guid: 47853bf99a9cfe34190154b10c14bd41
folderAsset: yes
timeCreated: 1440209472
timeCreated: 1440210034
licenseType: Free
DefaultImporter:
userData:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: df0b0e44ea338844b83cceb8f298758e
timeCreated: 1440254655
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 6bbe73bf6fc643b4884dba45b721bbcf
guid: 2653fcd9ac4f2664ab959d3420967ff3
folderAsset: yes
timeCreated: 1440209547
timeCreated: 1440210034
licenseType: Free
DefaultImporter:
userData:

22
Assets/Scripts/Bed.cs Normal file
View File

@ -0,0 +1,22 @@
using UnityEngine;
using System.Collections;
public class Bed : MonoBehaviour
{
private bool _isTaken;
public bool IsTaken
{
get { return _isTaken; }
}
public void Take()
{
_isTaken = true;
}
public void Leave()
{
_isTaken = false;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 49fab454291c16d4185f7f6a511de185
timeCreated: 1440250042
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -2,21 +2,26 @@
using System.Collections;
[RequireComponent(typeof(Rigidbody))]
public class Child : MonoBehaviour
public class Child : MonoBehaviour
{
public float Speed = 10f;
public float JumpForce = 10f;
public float MaxInvulnerableTime = 2f;
public GameObject GroundCheck;
public Pillow pillow;
public MomBehavior Mom;
private Rigidbody _rb;
private bool _isGrounded = false;
private float _xValue;
private float _zValue;
private bool _isSleeping;
private float _invulnerableTime;
private Bed _currentBed;
public Transform target;
private int _index;
private bool _isPushed = false;
public int Index
{
@ -38,7 +43,14 @@ public class Child : MonoBehaviour
void Update()
{
_isGrounded = IsGrounded();
if (Mom.IsInRoom && !_isSleeping)
{
// TODO: Remove a life, kill the player, end the game, etc.
Debug.Log("Player " + _index + " is being spotted by mom.");
}
// look at the target
if (target != null) {
transform.LookAt(target);
@ -61,16 +73,29 @@ public class Child : MonoBehaviour
{
// We move the child depending on the camera orientation
Vector3 forwardDir = Camera.main.transform.forward;
Vector3 rightDir = Camera.main.transform.right;
if (_isPushed)
{
if (_rb.velocity == Vector3.zero)
{
_isPushed = false;
}
}
else
{
Vector3 forwardDir = Camera.main.transform.forward;
Vector3 rightDir = Camera.main.transform.right;
forwardDir *= _zValue * Speed;
forwardDir.y = _rb.velocity.y;
forwardDir.y = 0f;
forwardDir = forwardDir.normalized * _zValue * Speed;
rightDir *= _xValue * Speed;
rightDir.y = 0f;
rightDir.y = 0f;
rightDir = rightDir.normalized * _xValue * Speed;
_rb.velocity = forwardDir + rightDir;
Vector3 movement = forwardDir + rightDir;
movement.y = _rb.velocity.y;
_rb.velocity = movement;
}
}
private bool IsGrounded()
@ -100,11 +125,15 @@ public class Child : MonoBehaviour
public bool Sleep()
{
_isSleeping = IsOnBed();
Bed bed = GetBed();
// Temporary (only for visual cue until we get the animation)
if (_isSleeping)
if (bed != null && !bed.IsTaken)
{
_currentBed = bed;
bed.Take();
_isSleeping = true;
// Temporary (only for visual cue until we get the animation)
transform.localEulerAngles = new Vector3(90f, transform.localEulerAngles.y, transform.localEulerAngles.z);
}
@ -115,14 +144,90 @@ public class Child : MonoBehaviour
{
_isSleeping = false;
_currentBed.Leave();
_currentBed = null;
// Temporary (only for visual cue until we get the animation)
transform.localEulerAngles = new Vector3(0f, transform.localEulerAngles.y, transform.localEulerAngles.z);
}
private bool IsOnBed()
private Bed GetBed()
{
Collider[] colliders = Physics.OverlapSphere(GroundCheck.transform.position, 0.149f, 1 << LayerMask.NameToLayer("Bed"));
return colliders.Length > 0;
return colliders.Length > 0 ? colliders[0].GetComponent<Bed>() : null;
}
}
void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Lava")
{
Debug.Log("Player " + _index + " entered lava. Lose one life.");
TakeLavaDamage();
ActivateVibration(true);
}
else
{
// Setup for the next time the player falls on the lava
_invulnerableTime = MaxInvulnerableTime;
if (collision.gameObject.tag == "Floor")
{
ActivateVibration(false);
}
}
}
void OnCollisionExit(Collision collision)
{
if (collision.gameObject.tag == "Lava" || collision.gameObject.tag == "Floor")
{
ActivateVibration(false);
}
}
void OnCollisionStay(Collision collision)
{
if (collision.gameObject.tag == "Lava")
{
_invulnerableTime += Time.deltaTime;
if (_invulnerableTime >= MaxInvulnerableTime)
{
Debug.Log("Player " + _index + " is still standing on lava. Lose one life.");
TakeLavaDamage();
}
ActivateVibration(true);
}
else if (collision.gameObject.tag == "Floor")
{
ActivateVibration(false);
}
}
public void Push(Vector3 force)
{
_isPushed = true;
_rb.AddForce(force);
}
private void ActivateVibration(bool activate)
{
float intensity = activate ? 0.3f : 0f;
XInputDotNetPure.GamePad.SetVibration((XInputDotNetPure.PlayerIndex)_index, intensity, intensity);
}
private void TakeLavaDamage()
{
// TODO: Lose a life (probably) and become immune for ~ 2 or 3 seconds
_invulnerableTime = 0f;
}
void OnDestroy()
{
ActivateVibration(false);
}
}

37
Assets/Scripts/Floor.cs Normal file
View File

@ -0,0 +1,37 @@
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(MeshRenderer))]
public class Floor : MonoBehaviour
{
public MomBehavior Mom;
public Material NormalMaterial;
public Material LavaMaterial;
private MeshRenderer _renderer;
void Awake()
{
_renderer = GetComponent<MeshRenderer>();
Mom.OnEnterRoom += ChangeToNormalFloor;
Mom.OnLeaveRoom += ChangeToLavaFloor;
}
private void ChangeToNormalFloor()
{
_renderer.material = NormalMaterial;
gameObject.tag = "Floor"; // Might not be necessary since the player is most likely "dead" if he touches a non-lava floor
}
private void ChangeToLavaFloor()
{
_renderer.material = LavaMaterial;
gameObject.tag = "Lava"; // Might not be necessary since the player is most likely "dead" if he touches a non-lava floor
}
void OnDestroy()
{
Mom.OnEnterRoom -= ChangeToNormalFloor;
Mom.OnLeaveRoom -= ChangeToLavaFloor;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 02652121580aeae49b2763bdc924ad87
timeCreated: 1440233203
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
using UnityEngine;
using System.Collections;
public interface IMomObserver
{
void NotifyWarning();
void Notify();
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b12285e2e2df80d409ada81aa2ba22be
timeCreated: 1440233305
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,24 +1,37 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
using System;
public class MomBehavior : MonoBehaviour
{
public Child[] Children;
public Action OnWarning;
public Action OnEnterRoom;
public Action OnLeaveRoom;
public Text WarningText;
public float MinTriggerTime = 60f;
public float MaxTriggerTime = 90f;
public float WarningHeadsupTime = 5f;
public float MotherStayTime = 2f;
public Child[] Children;
private float _elapsedTime = 0f;
private float _nextTriggerTime;
private bool _isInRoom;
public bool IsInRoom
{
get { return _isInRoom; }
}
void Awake()
{
_nextTriggerTime = GetNextTriggerTime();
Debug.Log("NextTrigger: " + _nextTriggerTime);
}
void Update()
@ -30,23 +43,58 @@ public class MomBehavior : MonoBehaviour
if (_elapsedTime >= _nextTriggerTime - WarningHeadsupTime && _elapsedTime < _nextTriggerTime)
{
WarningText.gameObject.SetActive(true);
if (OnWarning != null)
{
OnWarning();
}
}
else if (_elapsedTime >= _nextTriggerTime)
{
WarningText.gameObject.SetActive(false);
_nextTriggerTime = GetNextTriggerTime();
_elapsedTime = 0f;
StartCoroutine(StayInRoom());
}
if (_isInRoom)
{
List<Child> spottedChildren = new List<Child>();
List<Child> safeChildren = new List<Child>();
foreach (Child child in Children)
{
if (!child.IsSleeping)
{
// TODO: Do something (end the game? kill the player? make him lose 1 life? etc.)
Debug.Log("Child " + child.Index + " got found by Mommy.");
spottedChildren.Add(child);
}
}
_elapsedTime = 0f;
if (spottedChildren.Count > 0)
{
// TODO: Show a message mentionning the "dead" children
}
}
}
private IEnumerator StayInRoom()
{
if (OnEnterRoom != null)
{
OnEnterRoom();
}
_isInRoom = true;
yield return new WaitForSeconds(MotherStayTime);
_isInRoom = false;
if (OnLeaveRoom != null)
{
OnLeaveRoom();
}
}

9
Assets/Test.meta Normal file
View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 03870f11c780e164d82b313bbf402922
folderAsset: yes
timeCreated: 1440264961
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

41
Assets/Test/Door.cs Normal file
View File

@ -0,0 +1,41 @@
using UnityEngine;
using System.Collections;
public class Door : MonoBehaviour {
private float state = 0f; //From 0 to 1 (closed to open)
private float goal = -1f; //-1 or 1
public float angles;
public float openingSpeed;
public AnimationCurve curvature;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.A))
{
goal *= -1;
}
state = Mathf.Clamp(state + goal * openingSpeed * Time.deltaTime, 0f, 1f);
//transform.rotation = Quaternion.identity;
//transform.Rotate(Vector3.up * state * angles);
transform.rotation = Quaternion.Euler(Vector3.up * curvature.Evaluate(state) * -angles);
}
public void Open()
{
}
public void Close()
{
}
}

12
Assets/Test/Door.cs.meta Normal file
View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c921a0b390e23b64a94eb3e55d68e369
timeCreated: 1440269019
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

19
Assets/Test/LightOnOff.cs Normal file
View File

@ -0,0 +1,19 @@
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(Light))]
public class LightOnOff : MonoBehaviour {
private Light light;
// Use this for initialization
void Start () {
light = GetComponent<Light>();
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.Space))
light.enabled = !light.enabled;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 11e1c2efd004a114cb9e2b988d81ac69
timeCreated: 1440264969
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,2 +1,2 @@
m_EditorVersion: 5.1.2f1
m_EditorVersion: 5.0.2f1
m_StandardAssetsVersion: 0

Binary file not shown.