Conflicts:
	Assets/Scripts/Child.cs
This commit is contained in:
RosimInc 2015-08-22 18:40:57 -04:00
commit 2b47de9dba
63 changed files with 1329 additions and 13 deletions

Binary file not shown.

View File

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

Binary file not shown.

View File

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

Binary file not shown.

View File

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

BIN
Assets/Art/SM_Murs.FBX Normal file

Binary file not shown.

View File

@ -0,0 +1,76 @@
fileFormatVersion: 2
guid: 56d82b7f76516a84f8211df1eb5a5fa6
timeCreated: 1440280503
licenseType: Free
ModelImporter:
serializedVersion: 18
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2300000: //RootNode
3300000: //RootNode
4300000: Box069
7400000: Take 001
9500000: //RootNode
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: 2
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

View File

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: 4ad4c34103ab4324b8b58db40381543f
timeCreated: 1440270898
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.

View File

@ -0,0 +1,76 @@
fileFormatVersion: 2
guid: 468783296f7855642ae57783908446f7
timeCreated: 1440281885
licenseType: Free
ModelImporter:
serializedVersion: 18
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2300000: //RootNode
3300000: //RootNode
4300000: Box069
7400000: Take 001
9500000: //RootNode
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: 2
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Art/SM_Pillow.FBX Normal file

Binary file not shown.

View File

@ -0,0 +1,74 @@
fileFormatVersion: 2
guid: 5f25e7658d2291248b5b733de46d36c1
timeCreated: 1440280353
licenseType: Free
ModelImporter:
serializedVersion: 18
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2300000: //RootNode
3300000: //RootNode
4300000: SM_Pillow
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:

BIN
Assets/Art/SM_Porte.FBX Normal file

Binary file not shown.

View File

@ -0,0 +1,76 @@
fileFormatVersion: 2
guid: bf56788b08c37074dba5a2f79a7cc2ae
timeCreated: 1440280746
licenseType: Free
ModelImporter:
serializedVersion: 18
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2300000: //RootNode
3300000: //RootNode
4300000: Box073
7400000: Take 001
9500000: //RootNode
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: 2
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: aca8c195601f0354c965f406bf27cd5b
folderAsset: yes
timeCreated: 1440280044
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: 0500764176b5acc42864a1e6ca4d2331
timeCreated: 1440280044
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.

View File

@ -0,0 +1,76 @@
fileFormatVersion: 2
guid: 28f5bb6ff89c57f4da3fd2742cc40114
timeCreated: 1440280812
licenseType: Free
ModelImporter:
serializedVersion: 18
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2300000: //RootNode
3300000: //RootNode
4300000: Box074
7400000: Take 001
9500000: //RootNode
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: 2
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

9
Assets/Fonts.meta Normal file
View File

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

View File

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

Binary file not shown.

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 7ad9c0075fe8016418f05173debbc8ec
timeCreated: 1434250925
licenseType: Free
TrueTypeFontImporter:
serializedVersion: 2
fontSize: 16
forceTextureCase: -2
characterSpacing: 1
characterPadding: 0
includeFontData: 1
use2xBehaviour: 0
fontNames: []
customCharacters:
fontRenderingMode: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Prefabs/Door.prefab Normal file

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 519507fb75bbea241af0167b82acf64c
timeCreated: 1440281099
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

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

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6a495bf58d4ebd442b25dfc40a98e481
timeCreated: 1440270348
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

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

View File

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

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 38eb021af0911154aab92f72bc4f341a
timeCreated: 1432957259
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Prefabs/Walls.prefab Normal file

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0839912c1546d474686e48f2f1ea76fe
timeCreated: 1440271391
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -44,13 +44,6 @@ public class Child : MonoBehaviour
{ {
_isGrounded = IsGrounded(); _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 // look at the target
if (target != null) { if (target != null) {
transform.LookAt(target); transform.LookAt(target);

View File

@ -0,0 +1,73 @@
using UnityEngine;
using System.Collections;
using InputHandler;
using MenusHandler;
public class GameManager : MonoBehaviour
{
public int PlayerCount = 4;
private static GameManager _instance;
public static GameManager Instance
{
get { return _instance; }
}
void Awake()
{
_instance = this;
/*
if (_instance != null)
{
Destroy(gameObject);
}
else
{
_instance = this;
DontDestroyOnLoad(gameObject);
}*/
}
void Start()
{
for (int i = 0; i < PlayerCount; i++)
{
InputManager.Instance.AddCallback(i, HandleMenuInput);
}
}
public void PushMenuContext()
{
for (int i = 0; i < PlayerCount; i++)
{
InputManager.Instance.PushActiveContext("Menu", i);
}
}
public void PopMenuContext()
{
for (int i = 0; i < PlayerCount; i++)
{
InputManager.Instance.PopActiveContext(i);
}
}
private void HandleMenuInput(MappedInput input)
{
float yAxis = 0f;
if (input.Ranges.ContainsKey("SelectOptionUp"))
{
yAxis = input.Ranges["SelectOptionUp"];
}
else if (input.Ranges.ContainsKey("SelectOptionDown"))
{
yAxis = -input.Ranges["SelectOptionDown"];
}
bool accept = input.Actions.Contains("Accept");
MenusManager.Instance.SetInputValues(accept, false, 0f, yAxis);
}
}

View File

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

View File

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

View File

@ -0,0 +1,43 @@
using UnityEngine;
using System.Collections;
using MenusHandler;
using UnityEngine.UI;
public class PlayerWinsMenu : Menu
{
public Text Message;
public override void Open()
{
base.Open();
GameManager.Instance.PushMenuContext();
Time.timeScale = 0f;
}
public override void Close()
{
base.Close();
GameManager.Instance.PopMenuContext();
Time.timeScale = 1f;
}
public void SetPlayerIndex(int index)
{
Message.text = "Player " + (index + 1) + " Wins!";
}
public void OnRestartClick()
{
Time.timeScale = 1f;
Application.LoadLevel(Application.loadedLevel);
}
public void OnExitClick()
{
Application.Quit();
}
}

View File

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

View File

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

View File

@ -0,0 +1,28 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
namespace MenusHandler
{
[RequireComponent(typeof(MenuInputModule))]
public abstract class Menu : MonoBehaviour
{
private MenuInputModule _inputModule;
public MenuInputModule InputModule
{
get { return _inputModule; }
}
void Awake()
{
_inputModule = GetComponent<MenuInputModule>();
}
protected virtual void Start() { }
public virtual void Open() { }
public virtual void Close() { }
}
}

View File

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

View File

@ -0,0 +1,44 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System;
using UnityEngine.EventSystems;
namespace MenusHandler
{
public class MenuButton : Button
{
public Image LeftSelectorImage;
public Image RightSelectorImage;
protected override void Awake()
{
base.Awake();
LeftSelectorImage.gameObject.SetActive(false);
RightSelectorImage.gameObject.SetActive(false);
}
public override void OnSelect(UnityEngine.EventSystems.BaseEventData eventData)
{
base.OnSelect(eventData);
LeftSelectorImage.gameObject.SetActive(true);
RightSelectorImage.gameObject.SetActive(true);
}
public override void OnDeselect(UnityEngine.EventSystems.BaseEventData eventData)
{
base.OnDeselect(eventData);
LeftSelectorImage.gameObject.SetActive(false);
RightSelectorImage.gameObject.SetActive(false);
}
public void SetText(string text)
{
GetComponentInChildren<Text>().text = text;
}
}
}

View File

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

View File

@ -0,0 +1,197 @@
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using System;
using UnityEngine.Events;
namespace MenusHandler
{
[RequireComponent(typeof(EventSystem))]
public class MenuInputModule : BaseInputModule
{
public float Delay = 0.2f;
public float DeadZone = 0.5f;
public UnityEvent BackButtonEvent;
private EventSystem _eventSystem;
private bool _canNavigate = true;
private GameObject _previousTargettedObject;
private bool _acceptButtonPressed = false;
private bool _backButtonPressed = false;
private bool _menuDownPressed = false;
private bool _menuUpPressed = false;
private bool _menuRightPressed = false;
private bool _menuLeftPressed = false;
protected override void Start()
{
base.Start();
_eventSystem = GetComponent<EventSystem>();
}
public override void ActivateModule()
{
base.ActivateModule();
SelectFirstButton();
_canNavigate = true;
}
public override void Process()
{
if (_acceptButtonPressed)
{
ExecuteEvents.Execute(_eventSystem.currentSelectedGameObject.gameObject, new BaseEventData(eventSystem), ExecuteEvents.submitHandler);
}
else if (_backButtonPressed)
{
BackButtonEvent.Invoke();
}
else if (_canNavigate)
{
if (_menuRightPressed)
{
SelectRightButton();
}
else if (_menuLeftPressed)
{
SelectLeftButton();
}
else if (_menuDownPressed)
{
SelectDownButton();
}
else if (_menuUpPressed)
{
SelectUpButton();
}
}
_acceptButtonPressed = false;
_backButtonPressed = false;
_menuDownPressed = false;
_menuUpPressed = false;
_menuRightPressed = false;
_menuLeftPressed = false;
}
public void ChangeFirstButton(Selectable button)
{
_eventSystem.firstSelectedGameObject = button.gameObject;
}
public void SelectFirstButton()
{
if (_eventSystem.firstSelectedGameObject == null) return;
if (_eventSystem.currentSelectedGameObject != _eventSystem.firstSelectedGameObject)
{
ExecuteEvents.Execute(_eventSystem.currentSelectedGameObject, new BaseEventData(eventSystem), ExecuteEvents.deselectHandler);
}
ExecuteEvents.Execute(_eventSystem.firstSelectedGameObject, new BaseEventData(eventSystem), ExecuteEvents.selectHandler);
_eventSystem.SetSelectedGameObject(_eventSystem.firstSelectedGameObject);
}
private void SelectLeftButton()
{
if (_eventSystem.currentSelectedGameObject == null) return;
Selectable toBeSelected = _eventSystem.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnLeft();
if (toBeSelected != null)
{
_eventSystem.SetSelectedGameObject(toBeSelected.gameObject);
StartCoroutine("PauseNavigation");
}
}
private void SelectRightButton()
{
if (_eventSystem.currentSelectedGameObject == null) return;
Selectable toBeSelected = _eventSystem.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnRight();
if (toBeSelected != null)
{
_eventSystem.SetSelectedGameObject(toBeSelected.gameObject);
StartCoroutine("PauseNavigation");
}
}
private void SelectUpButton()
{
if (_eventSystem.currentSelectedGameObject == null) return;
Selectable toBeSelected = _eventSystem.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnUp();
if (toBeSelected != null)
{
_eventSystem.SetSelectedGameObject(toBeSelected.gameObject);
StartCoroutine("PauseNavigation");
}
}
private void SelectDownButton()
{
if (_eventSystem.currentSelectedGameObject == null) return;
Selectable toBeSelected = _eventSystem.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnDown();
if (toBeSelected != null)
{
_eventSystem.SetSelectedGameObject(toBeSelected.gameObject);
StartCoroutine("PauseNavigation");
}
}
// Adds a delay before we can switch options again
private IEnumerator PauseNavigation()
{
_canNavigate = false;
float elapsedTime = 0f;
// Since the game might be paused here, we can't do "yield return new WaitForSeconds(0.2f);"
while (elapsedTime < Delay)
{
elapsedTime += Time.unscaledDeltaTime;
yield return null;
}
_canNavigate = true;
}
public void SetInputValues(bool acceptButton, bool backButton, float horizontalAxis, float verticalAxis)
{
if (acceptButton)
{
_acceptButtonPressed = true;
}
if (backButton)
{
_backButtonPressed = true;
}
if (verticalAxis != 0f)
{
_menuDownPressed = verticalAxis < -DeadZone;
_menuUpPressed = verticalAxis > DeadZone;
}
if (horizontalAxis != 0f)
{
_menuRightPressed = horizontalAxis > DeadZone;
_menuLeftPressed = horizontalAxis < -DeadZone;
}
}
}
}

View File

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

View File

@ -0,0 +1,123 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
namespace MenusHandler
{
public class MenusManager : MonoBehaviour
{
public Action OnMenusOpened;
public Action OnMenusClosed;
public Menu[] Menus;
private static MenusManager _instance;
private Dictionary<string, Menu> _menus;
private Dictionary<string, Menu> _cachedMenus;
private Menu _currentMenu;
public static MenusManager Instance
{
get { return _instance; }
}
void Awake()
{
if (Instance)
{
Destroy(gameObject);
}
else
{
_instance = this;
_menus = new Dictionary<string, Menu>();
_cachedMenus = new Dictionary<string, Menu>();
foreach (Menu menu in Menus)
{
_menus[menu.name] = menu;
}
}
}
public Menu ShowMenu(string name)
{
if (_currentMenu != null)
{
CloseCurrentMenu();
}
if (!_cachedMenus.ContainsKey(name) || _cachedMenus[name] == null)
{
_cachedMenus[name] = Instantiate(_menus[name], Vector3.zero, Quaternion.identity) as Menu;
DontDestroyOnLoad(_cachedMenus[name]);
_cachedMenus[name].name = name;
}
_currentMenu = _cachedMenus[name];
OpenCurrentMenu();
return _currentMenu;
}
public void RequestClose()
{
CloseCurrentMenu();
}
public void SetInputValues(bool acceptButton, bool backButton, float horizontalAxis, float verticalAxis)
{
if (_currentMenu != null)
{
_currentMenu.InputModule.SetInputValues(acceptButton, backButton, horizontalAxis, verticalAxis);
}
}
void OnDestroy()
{
foreach (KeyValuePair<string, Menu> kvp in _cachedMenus)
{
if (kvp.Value != null)
{
Destroy(kvp.Value.gameObject);
}
}
}
void OnLevelWasLoaded(int levelIndex)
{
// When we load a new level, we close the currently active menu if it's still open
CloseCurrentMenu();
}
// Can change based on whether we simply hide the menus or destroy them
private void OpenCurrentMenu()
{
_currentMenu.gameObject.SetActive(true);
_currentMenu.Open();
if (OnMenusOpened != null)
{
OnMenusOpened();
}
}
// Can change based on whether we simply hide the menus or destroy them
private void CloseCurrentMenu()
{
if (_currentMenu != null && _currentMenu.gameObject.activeSelf)
{
_currentMenu.Close();
_currentMenu.gameObject.SetActive(false);
if (OnMenusClosed != null)
{
OnMenusClosed();
}
}
}
}
}

View File

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

View File

@ -3,6 +3,8 @@ using System.Collections;
using UnityEngine.UI; using UnityEngine.UI;
using System.Collections.Generic; using System.Collections.Generic;
using System; using System;
using MenusHandler;
using InputHandler;
public class MomBehavior : MonoBehaviour public class MomBehavior : MonoBehaviour
{ {
@ -24,6 +26,8 @@ public class MomBehavior : MonoBehaviour
private bool _isInRoom; private bool _isInRoom;
private bool _gameOver = false;
public bool IsInRoom public bool IsInRoom
{ {
get { return _isInRoom; } get { return _isInRoom; }
@ -36,6 +40,8 @@ public class MomBehavior : MonoBehaviour
void Update() void Update()
{ {
if (_gameOver) return;
// When the mom hasn't been triggered for a while, it can appear anytime between 2 borders // When the mom hasn't been triggered for a while, it can appear anytime between 2 borders
_elapsedTime += Time.deltaTime; _elapsedTime += Time.deltaTime;
@ -61,20 +67,42 @@ public class MomBehavior : MonoBehaviour
if (_isInRoom) if (_isInRoom)
{ {
List<Child> spottedChildren = new List<Child>();
List<Child> safeChildren = new List<Child>(); List<Child> safeChildren = new List<Child>();
foreach (Child child in Children) foreach (Child child in Children)
{ {
if (!child.IsSleeping) if (child == null) continue;
if (child.IsSleeping)
{ {
spottedChildren.Add(child); safeChildren.Add(child);
}
else
{
Debug.Log("Player " + child.Index + " has been spotted by mom.");
// TODO: Visual animation that the player lost (lasso?)
Destroy(child.gameObject);
} }
} }
if (spottedChildren.Count > 0) if (safeChildren.Count == 0)
{ {
// TODO: Show a message mentionning the "dead" children Debug.Log("Mom wins!");
MenusManager.Instance.ShowMenu("MomWinsMenu");
_gameOver = true;
}
else if (safeChildren.Count == 1)
{
Debug.Log("Player " + safeChildren[0].Index + " wins!");
PlayerWinsMenu menu = (PlayerWinsMenu)MenusManager.Instance.ShowMenu("PlayerWinsMenu");
menu.SetPlayerIndex(safeChildren[0].Index);
_gameOver = true;
} }
} }
} }

9
Assets/Sprites.meta Normal file
View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: bb6a5d6e11b51d5449dd5b0f5230903c
timeCreated: 1434250341
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: -3
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 12, y: 12, z: 12, w: 12}
spritePixelsToUnits: 400
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View File

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