This commit is contained in:
jparent 2015-08-23 15:05:27 -04:00
commit 1f2ff293b2
26 changed files with 417 additions and 811 deletions

View File

@ -164,7 +164,7 @@ MonoBehaviour:
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 0} m_Sprite: {fileID: 0}
m_Type: 0 m_Type: 0
m_PreserveAspect: 0 m_PreserveAspect: 1
m_FillCenter: 1 m_FillCenter: 1
m_FillMethod: 4 m_FillMethod: 4
m_FillAmount: 1 m_FillAmount: 1
@ -185,7 +185,7 @@ MonoBehaviour:
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 0} m_Sprite: {fileID: 0}
m_Type: 0 m_Type: 0
m_PreserveAspect: 0 m_PreserveAspect: 1
m_FillCenter: 1 m_FillCenter: 1
m_FillMethod: 4 m_FillMethod: 4
m_FillAmount: 1 m_FillAmount: 1
@ -214,8 +214,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
WarningText: {fileID: 11404408} WarningText: {fileID: 11404408}
MinTriggerTime: 30 MinTriggerTime: 20
MaxTriggerTime: 45 MaxTriggerTime: 30
WarningHeadsupTime: 5 WarningHeadsupTime: 5
MotherStayTime: 5 MotherStayTime: 5
RoomDoor: {fileID: 0} RoomDoor: {fileID: 0}
@ -237,7 +237,7 @@ MonoBehaviour:
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 0} m_Sprite: {fileID: 0}
m_Type: 0 m_Type: 0
m_PreserveAspect: 0 m_PreserveAspect: 1
m_FillCenter: 1 m_FillCenter: 1
m_FillMethod: 4 m_FillMethod: 4
m_FillAmount: 1 m_FillAmount: 1
@ -312,7 +312,7 @@ MonoBehaviour:
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 0} m_Sprite: {fileID: 0}
m_Type: 0 m_Type: 0
m_PreserveAspect: 0 m_PreserveAspect: 1
m_FillCenter: 1 m_FillCenter: 1
m_FillMethod: 4 m_FillMethod: 4
m_FillAmount: 1 m_FillAmount: 1
@ -415,10 +415,10 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 22413388} m_Father: {fileID: 22413388}
m_RootOrder: 4 m_RootOrder: 4
m_AnchorMin: {x: 1, y: 0} m_AnchorMin: {x: .810000002, y: 0}
m_AnchorMax: {x: 1, y: 0} m_AnchorMax: {x: 1, y: .300000012}
m_AnchoredPosition: {x: -84.5, y: 108} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 169, y: 216} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5} m_Pivot: {x: .5, y: .5}
--- !u!224 &22441784 --- !u!224 &22441784
RectTransform: RectTransform:
@ -467,10 +467,10 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 22413388} m_Father: {fileID: 22413388}
m_RootOrder: 1 m_RootOrder: 1
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: .699999988}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: .189999998, y: 1}
m_AnchoredPosition: {x: 90, y: -113} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 169, y: 216} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5} m_Pivot: {x: .5, y: .5}
--- !u!224 &22484266 --- !u!224 &22484266
RectTransform: RectTransform:
@ -485,9 +485,9 @@ RectTransform:
m_Father: {fileID: 22413388} m_Father: {fileID: 22413388}
m_RootOrder: 3 m_RootOrder: 3
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: .189999998, y: .300000012}
m_AnchoredPosition: {x: 84.5, y: 108} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 169, y: 216} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5} m_Pivot: {x: .5, y: .5}
--- !u!224 &22497504 --- !u!224 &22497504
RectTransform: RectTransform:
@ -501,10 +501,10 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 22413388} m_Father: {fileID: 22413388}
m_RootOrder: 2 m_RootOrder: 2
m_AnchorMin: {x: 1, y: 1} m_AnchorMin: {x: .810000002, y: .699999988}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -84.5, y: -108} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 169, y: 216} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5} m_Pivot: {x: .5, y: .5}
--- !u!1001 &100100000 --- !u!1001 &100100000
Prefab: Prefab:

View File

@ -608,6 +608,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 88e55981fb5053743beab34a961a19e6, type: 3} m_Script: {fileID: 11500000, guid: 88e55981fb5053743beab34a961a19e6, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!114 &638369586 stripped
MonoBehaviour:
m_PrefabParentObject: {fileID: 11406004, guid: 7b2324b0ba2cbba47a32db098a5a4a3b,
type: 2}
m_PrefabInternal: {fileID: 488401107}
m_Script: {fileID: 11500000, guid: dd2c12784e85d194ca7216a12233e1fa, type: 3}
--- !u!1001 &673576178 --- !u!1001 &673576178
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -645,7 +651,7 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 22413388, guid: dec23153e975cb94db47e642092ad58e, type: 2} - target: {fileID: 22413388, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 10 value: 9
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 22413388, guid: dec23153e975cb94db47e642092ad58e, type: 2} - target: {fileID: 22413388, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchoredPosition.x propertyPath: m_AnchoredPosition.x
@ -691,146 +697,14 @@ Prefab:
propertyPath: RoomDoor propertyPath: RoomDoor
value: value:
objectReference: {fileID: 544939640} objectReference: {fileID: 544939640}
- target: {fileID: 120876, guid: dec23153e975cb94db47e642092ad58e, type: 2} - target: {fileID: 11451246, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_IsActive propertyPath: Children.Array.data[0]
value: 0 value:
objectReference: {fileID: 0} objectReference: {fileID: 981569108}
- target: {fileID: 22456076, guid: dec23153e975cb94db47e642092ad58e, type: 2} - target: {fileID: 11451246, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchorMin.x propertyPath: Children.Array.data[1]
value: 0 value:
objectReference: {fileID: 0} objectReference: {fileID: 638369586}
- target: {fileID: 22456076, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchorMax.x
value: .189999998
objectReference: {fileID: 0}
- target: {fileID: 22456076, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22456076, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchorMin.y
value: .699999988
objectReference: {fileID: 0}
- target: {fileID: 22456076, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 22456076, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22456076, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22456076, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11406010, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_PreserveAspect
value: 1
objectReference: {fileID: 0}
- target: {fileID: 188232, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22497504, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchorMin.y
value: .699999988
objectReference: {fileID: 0}
- target: {fileID: 22497504, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22497504, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22497504, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchorMin.x
value: .810000002
objectReference: {fileID: 0}
- target: {fileID: 22497504, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22497504, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 141632, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22484266, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchorMax.x
value: .189999998
objectReference: {fileID: 0}
- target: {fileID: 22484266, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22484266, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22484266, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchorMax.y
value: .300000012
objectReference: {fileID: 0}
- target: {fileID: 22484266, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22484266, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11406500, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_PreserveAspect
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11458950, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_PreserveAspect
value: 1
objectReference: {fileID: 0}
- target: {fileID: 180592, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22436868, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchorMin.x
value: .810000002
objectReference: {fileID: 0}
- target: {fileID: 22436868, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22436868, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22436868, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 22436868, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchorMax.y
value: .300000012
objectReference: {fileID: 0}
- target: {fileID: 22436868, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22436868, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11494372, guid: dec23153e975cb94db47e642092ad58e, type: 2}
propertyPath: m_PreserveAspect
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: dec23153e975cb94db47e642092ad58e, type: 2} m_ParentPrefab: {fileID: 100100000, guid: dec23153e975cb94db47e642092ad58e, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0
@ -1220,10 +1094,6 @@ Prefab:
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 2 value: 2
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6472040, guid: 0839912c1546d474686e48f2f1ea76fe, type: 2}
propertyPath: m_Material
value:
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 0839912c1546d474686e48f2f1ea76fe, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 0839912c1546d474686e48f2f1ea76fe, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0
@ -1273,6 +1143,12 @@ Prefab:
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 9f2c38d0d3154bc4d8148a949b98af28, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 9f2c38d0d3154bc4d8148a949b98af28, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0
--- !u!114 &981569108 stripped
MonoBehaviour:
m_PrefabParentObject: {fileID: 11430644, guid: 6dd661a967968c64dbae75c01fac6a09,
type: 2}
m_PrefabInternal: {fileID: 1928589739}
m_Script: {fileID: 11500000, guid: dd2c12784e85d194ca7216a12233e1fa, type: 3}
--- !u!1001 &987851018 --- !u!1001 &987851018
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -47,13 +47,13 @@ public class AutoTarget : MonoBehaviour
public Transform GetTarget(Vector3 lookingAngle) public Transform GetTarget(Vector3 lookingAngle)
{ {
return GetTarget(lookingAngle, 2000, minAngleRange); return GetTarget(lookingAngle, 2000, minAngleRange);
} }
public Transform GetTarget(Vector3 lookingAngle, float range, float minAngle) public Transform GetTarget(Vector3 lookingAngle, float range, float minAngle)
{ {
Transform closest = null; Transform closest = null;
float rangeSq = range * range; float rangeSq = range * range;
//Debug.Log("looking direction:" + lookingAngle); //Debug.Log("looking direction:" + lookingAngle);
Debug.DrawRay(transform.position, lookingAngle * 2); Debug.DrawRay(transform.position, lookingAngle * 2);
@ -61,12 +61,12 @@ public class AutoTarget : MonoBehaviour
foreach (Transform t in targets) foreach (Transform t in targets)
{ {
if (t == null) continue; if (t == null) continue;
Vector3 targetDirection = t.transform.position - transform.position; Vector3 targetDirection = t.transform.position - transform.position;
Debug.Log(targetDirection.magnitude); Debug.Log(targetDirection.magnitude);
if (targetDirection.sqrMagnitude > rangeSq) if (targetDirection.sqrMagnitude > rangeSq)
continue; continue;
float realAngle = Mathf.Atan2(targetDirection.z, targetDirection.x) * Mathf.Rad2Deg; float realAngle = Mathf.Atan2(targetDirection.z, targetDirection.x) * Mathf.Rad2Deg;

View File

@ -1,254 +1,254 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
[RequireComponent(typeof(Rigidbody))] [RequireComponent(typeof(Rigidbody))]
public class Child : MonoBehaviour public class Child : MonoBehaviour
{ {
public float Speed = 10f; public float Speed = 10f;
public float JumpForce = 10f; public float JumpForce = 10f;
public float MaxInvulnerableTime = 2f; public float MaxInvulnerableTime = 2f;
public float ThrowForce = 30f; public float ThrowForce = 30f;
public float HitForce = 3f; public float HitForce = 3f;
public float hitPushBackForce = 250f; public float hitPushBackForce = 250f;
public float yAngleVector = 9f; public float yAngleVector = 9f;
public GameObject GroundCheck; public GameObject GroundCheck;
public Pillow pillow; public Pillow pillow;
public MomBehavior Mom; public MomBehavior Mom;
public PlayerAvatar Avatar; public PlayerAvatar Avatar;
public Animator Animator; public Animator Animator;
public GameObject AnimationPillow; public GameObject AnimationPillow;
private Rigidbody _rb; private Rigidbody _rb;
private bool _isGrounded = false; private bool _isGrounded = false;
private float _xValue; private float _xValue;
private float _zValue; private float _zValue;
private bool _isSleeping; private bool _isSleeping;
private float _invulnerableTime; private float _invulnerableTime;
private Bed _currentBed; private Bed _currentBed;
private bool _isInLava; private bool _isInLava;
private int _index; private int _index;
private bool _isPushed = false; private bool _isPushed = false;
private bool _wasPushed = false; private bool _wasPushed = false;
private Vector3 _pushedDir; private Vector3 _pushedDir;
private float _stunTime; private float _stunTime;
private int _numZ = 0; private int _numZ = 0;
public int NumZ public int NumZ
{ {
get { return _numZ; } get { return _numZ; }
set set
{ {
_numZ = value; _numZ = value;
Avatar.NumZ = _numZ; Avatar.NumZ = _numZ;
if (_numZ == 3) Die(); if (_numZ == 3) Die();
} }
} }
private AutoTarget _autoTarget; private AutoTarget _autoTarget;
public int Index public int Index
{ {
get { return _index; } get { return _index; }
set { _index = value; } set { _index = value; }
} }
public bool IsSleeping public bool IsSleeping
{ {
get { return _isSleeping; } get { return _isSleeping; }
} }
void Awake() void Awake()
{ {
_rb = GetComponent<Rigidbody>(); _rb = GetComponent<Rigidbody>();
AnimationPillow.SetActive(false); AnimationPillow.SetActive(false);
_autoTarget = GetComponent<AutoTarget>(); _autoTarget = GetComponent<AutoTarget>();
} }
void Start() void Start()
{ {
Avatar.PlayerNum = Index + 1; Avatar.PlayerNum = Index + 1;
} }
void Update() void Update()
{ {
Animator.SetBool("IsOnBed", GetBed()); Animator.SetBool("IsOnBed", GetBed());
_isGrounded = IsGrounded(); _isGrounded = IsGrounded();
// We move the child depending on the camera orientation // We move the child depending on the camera orientation
if (_stunTime >= Time.deltaTime * 3f && _wasPushed && _rb.velocity == Vector3.zero) if (_stunTime >= Time.deltaTime * 3f && _wasPushed && _rb.velocity == Vector3.zero)
{ {
_wasPushed = false; _wasPushed = false;
} }
if (_isPushed) if (_isPushed)
{ {
_stunTime += Time.deltaTime; _stunTime += Time.deltaTime;
if (_stunTime >= Time.deltaTime * 3f && _rb.velocity == Vector3.zero) if (_stunTime >= Time.deltaTime * 3f && _rb.velocity == Vector3.zero)
{ {
_isPushed = false; _isPushed = false;
_wasPushed = true; _wasPushed = true;
} }
} }
else else
{ {
_stunTime = 0f; _stunTime = 0f;
Vector3 forwardDir = Camera.main.transform.forward; Vector3 forwardDir = Camera.main.transform.forward;
Vector3 rightDir = Camera.main.transform.right; Vector3 rightDir = Camera.main.transform.right;
forwardDir.y = 0f; forwardDir.y = 0f;
forwardDir = forwardDir.normalized * _zValue * Speed; forwardDir = forwardDir.normalized * _zValue * Speed;
rightDir.y = 0f; rightDir.y = 0f;
rightDir = rightDir.normalized * _xValue * Speed; rightDir = rightDir.normalized * _xValue * Speed;
Vector3 movement = forwardDir + rightDir; Vector3 movement = forwardDir + rightDir;
movement.y = _rb.velocity.y; movement.y = _rb.velocity.y;
_rb.velocity = movement; _rb.velocity = movement;
} }
} }
public void ThrowMecanimPillow() public void ThrowMecanimPillow()
{ {
if (pillow == null) return; if (pillow == null) return;
Transform target = _autoTarget.GetTarget(transform.forward); Transform target = _autoTarget.GetTarget(transform.forward);
Vector3 direction; Vector3 direction;
if (target != null) if (target != null)
{ {
direction = target.transform.position - pillow.transform.position; direction = target.transform.position - pillow.transform.position;
} }
else else
{ {
direction = transform.forward; direction = transform.forward;
} }
direction = direction.normalized; direction = direction.normalized;
pillow.gameObject.SetActive(true); pillow.gameObject.SetActive(true);
pillow.transform.localPosition = new Vector3(0.109f, -0.407f, 0.389f); pillow.transform.localPosition = new Vector3(0.109f, -0.407f, 0.389f);
pillow.transform.localEulerAngles = new Vector3(0f, 204.46f, 310.0002f); pillow.transform.localEulerAngles = new Vector3(0f, 204.46f, 310.0002f);
AnimationPillow.SetActive(false); AnimationPillow.SetActive(false);
pillow.Throw(direction * ThrowForce); pillow.Throw(direction * ThrowForce);
pillow.IsOwned = false; pillow.IsOwned = false;
target = null; target = null;
pillow = null; pillow = null;
} }
void OnTriggerEnter(Collider other) { void OnTriggerEnter(Collider other) {
if (other.tag == "Pillow"){ if (other.tag == "Pillow"){
Pillow incomingPillow = other.GetComponent<Pillow>(); Pillow incomingPillow = other.GetComponent<Pillow>();
// getting hit by a pillow // getting hit by a pillow
if (incomingPillow.IsThrown) { if (incomingPillow.IsThrown) {
Debug.Log("abc"); Debug.Log("abc");
if (incomingPillow.Owner != this) if (incomingPillow.Owner != this)
{ {
//player is hit //player is hit
Debug.Log("Child is hit by a pillow"); Debug.Log("Child is hit by a pillow");
Push(other.GetComponent<Rigidbody>().velocity.normalized * 10 * hitPushBackForce); Push(other.GetComponent<Rigidbody>().velocity.normalized * 10 * hitPushBackForce);
Destroy(other.gameObject); Destroy(other.gameObject);
} }
} }
// picking up a pillow // picking up a pillow
else if (this.pillow == null && incomingPillow.IsPickable) { else if (this.pillow == null && incomingPillow.IsPickable) {
Debug.Log("def"); Debug.Log("def");
pillow = incomingPillow; pillow = incomingPillow;
pillow.transform.parent = transform; // make the pillow a child of Child pillow.transform.parent = transform; // make the pillow a child of Child
pillow.gameObject.SetActive(false); pillow.gameObject.SetActive(false);
pillow.GetComponent<Rigidbody>().isKinematic = true; // dont make pillow obey to gravity when in a child's hands pillow.GetComponent<Rigidbody>().isKinematic = true; // dont make pillow obey to gravity when in a child's hands
pillow.IsOwned = true; pillow.IsOwned = true;
pillow.Owner = this; pillow.Owner = this;
AnimationPillow.SetActive(true); AnimationPillow.SetActive(true);
// TODO: place the pillow correctly or animate or something... // TODO: place the pillow correctly or animate or something...
} }
} }
} }
private bool IsGrounded() private bool IsGrounded()
{ {
int mask = (1 << LayerMask.NameToLayer("Ground")) | (1 << LayerMask.NameToLayer("Bed")); int mask = (1 << LayerMask.NameToLayer("Ground")) | (1 << LayerMask.NameToLayer("Bed"));
Collider[] colliders = Physics.OverlapSphere(GroundCheck.transform.position, 0.149f, mask); Collider[] colliders = Physics.OverlapSphere(GroundCheck.transform.position, 0.149f, mask);
return colliders.Length > 0; return colliders.Length > 0;
} }
public void Move(float xValue, float zValue) public void Move(float xValue, float zValue)
{ {
_xValue = xValue; _xValue = xValue;
_zValue = zValue; _zValue = zValue;
} }
public void Jump() public void Jump()
{ {
if (_isGrounded) if (_isGrounded)
{ {
_isGrounded = false; _isGrounded = false;
_rb.AddForce(new Vector3(0f, JumpForce, 0f)); _rb.AddForce(new Vector3(0f, JumpForce, 0f));
Animator.SetTrigger("jump"); Animator.SetTrigger("jump");
} }
} }
public bool Sleep() public bool Sleep()
{ {
Bed bed = GetBed(); Bed bed = GetBed();
if (bed != null && !bed.IsTaken) if (bed != null && !bed.IsTaken)
{ {
_currentBed = bed; _currentBed = bed;
bed.Take(); bed.Take();
_isSleeping = true; _isSleeping = true;
Animator.SetBool("IsSleeping", true); Animator.SetBool("IsSleeping", true);
} }
return _isSleeping; return _isSleeping;
} }
public void WakeUp() public void WakeUp()
{ {
_isSleeping = false; _isSleeping = false;
Animator.SetBool("IsSleeping", false); Animator.SetBool("IsSleeping", false);
_currentBed.Leave(); _currentBed.Leave();
_currentBed = null; _currentBed = null;
} }
public Bed GetBed() public Bed GetBed()
{ {
Collider[] colliders = Physics.OverlapSphere(GroundCheck.transform.position, 0.149f, 1 << LayerMask.NameToLayer("Bed")); Collider[] colliders = Physics.OverlapSphere(GroundCheck.transform.position, 0.149f, 1 << LayerMask.NameToLayer("Bed"));
return colliders.Length > 0 ? colliders[0].GetComponent<Bed>() : null; return colliders.Length > 0 ? colliders[0].GetComponent<Bed>() : null;
} }
public void Throw() { public void Throw() {
if (_isInLava) return; if (_isInLava) return;
if (pillow != null) { if (pillow != null) {
Animator.SetTrigger("StartAttack"); Animator.SetTrigger("StartAttack");
} }
} }
public void Swing() public void Swing()
@ -267,102 +267,105 @@ public class Child : MonoBehaviour
direction = direction.normalized; direction = direction.normalized;
t.gameObject.GetComponent<Child>().Push(direction * HitForce); t.gameObject.GetComponent<Child>().Push(direction * HitForce);
} }
void OnCollisionEnter(Collision collision) void OnCollisionEnter(Collision collision)
{ {
if (collision.gameObject.tag == "Lava") if (collision.gameObject.tag == "Lava")
{ {
Debug.Log("Player " + _index + " entered lava. Lose one life."); Debug.Log("Player " + _index + " entered lava. Lose one life.");
TakeLavaDamage(); TakeLavaDamage();
ActivateVibration(true); ActivateVibration(true);
Animator.SetBool("IsOnLava", true); Animator.SetBool("IsOnLava", true);
_isInLava = true; _isInLava = true;
} }
else else
{ {
// Setup for the next time the player falls on the lava // Setup for the next time the player falls on the lava
//_invulnerableTime = MaxInvulnerableTime; //_invulnerableTime = MaxInvulnerableTime;
if (collision.gameObject.tag == "Floor") if (collision.gameObject.tag == "Floor")
{ {
ActivateVibration(false); ActivateVibration(false);
} }
} }
} }
void OnCollisionExit(Collision collision) void OnCollisionExit(Collision collision)
{ {
if (collision.gameObject.tag == "Lava" || collision.gameObject.tag == "Floor") if (collision.gameObject.tag == "Lava" || collision.gameObject.tag == "Floor")
{ {
ActivateVibration(false); ActivateVibration(false);
Animator.SetBool("IsOnLava", false); Animator.SetBool("IsOnLava", false);
_isInLava = false; _isInLava = false;
} }
} }
void OnCollisionStay(Collision collision) void OnCollisionStay(Collision collision)
{ {
if (collision.gameObject.tag == "Lava") if (collision.gameObject.tag == "Lava")
{ {
_invulnerableTime += Time.deltaTime; _invulnerableTime += Time.deltaTime;
if (_invulnerableTime >= MaxInvulnerableTime) if (_invulnerableTime >= MaxInvulnerableTime)
{ {
Debug.Log("Player " + _index + " is still standing on lava. Lose one life."); Debug.Log("Player " + _index + " is still standing on lava. Lose one life.");
TakeLavaDamage(); TakeLavaDamage();
} }
ActivateVibration(true); ActivateVibration(true);
} }
else if (collision.gameObject.tag == "Floor") else if (collision.gameObject.tag == "Floor")
{ {
ActivateVibration(false); ActivateVibration(false);
} }
else if (_wasPushed && collision.gameObject.tag == "Walls") else if (_wasPushed && collision.gameObject.tag == "Walls")
{ {
/* /*
_wasPushed = false; _wasPushed = false;
Push(Vector3.Reflect(_pushedDir.normalized, collision.contacts[0].normal) * _pushedDir.magnitude);*/ Push(Vector3.Reflect(_pushedDir.normalized, collision.contacts[0].normal) * _pushedDir.magnitude);*/
} }
} }
public void Push(Vector3 force) public void Push(Vector3 force)
{ {
_isPushed = true; _isPushed = true;
Debug.Log(force); Debug.Log(force);
force.y = yAngleVector; force.y = yAngleVector;
_rb.AddForce(force, ForceMode.Impulse); _rb.AddForce(force, ForceMode.Impulse);
_pushedDir = force; _pushedDir = force;
} }
private void ActivateVibration(bool activate) private void ActivateVibration(bool activate)
{ {
float intensity = activate ? 0.3f : 0f; float intensity = activate ? 0.3f : 0f;
XInputDotNetPure.GamePad.SetVibration((XInputDotNetPure.PlayerIndex)_index, intensity, intensity); XInputDotNetPure.GamePad.SetVibration((XInputDotNetPure.PlayerIndex)_index, intensity, intensity);
} }
private void TakeLavaDamage() private void TakeLavaDamage()
{ {
NumZ += 1; NumZ += 1;
// TODO: Lose a life (probably) and become immune for ~ 2 or 3 seconds // TODO: Lose a life (probably) and become immune for ~ 2 or 3 seconds
_invulnerableTime = 0f; _invulnerableTime = 0f;
} }
void Die() void Die()
{ {
Destroy(gameObject); PlayerWinsMenu menu = (PlayerWinsMenu)MenusHandler.MenusManager.Instance.ShowMenu("PlayerWinsMenu");
} menu.SetPlayerIndex(this.Index);
void OnDestroy() Destroy(gameObject);
{ }
ActivateVibration(false);
} void OnDestroy()
} {
ActivateVibration(false);
}
}

View File

@ -116,6 +116,8 @@ public class MomBehavior : MonoBehaviour
{ {
if (child == null) continue; if (child == null) continue;
Debug.Log(child.IsSleeping);
if (child.IsSleeping) if (child.IsSleeping)
{ {
safeChildren.Add(child); safeChildren.Add(child);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e06a41f1643dbac4595002871a5e5d53 guid: fbc5a3f21b953ea4ca66189910320d64
timeCreated: 1440338588 timeCreated: 1440352933
licenseType: Free licenseType: Free
TextureImporter: TextureImporter:
fileIDToRecycleName: {} fileIDToRecycleName: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 10404f9b22fe2a148ad883d271da76e0 guid: bc957cb3031b7e849a0265eef1496b33
timeCreated: 1440338587 timeCreated: 1440352933
licenseType: Free licenseType: Free
TextureImporter: TextureImporter:
fileIDToRecycleName: {} fileIDToRecycleName: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6fb3add0bf5619c4b95933df09116277 guid: 6c5853d409a55a040802a54246c34e0d
timeCreated: 1440338588 timeCreated: 1440352933
licenseType: Free licenseType: Free
TextureImporter: TextureImporter:
fileIDToRecycleName: {} fileIDToRecycleName: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 86c7586eab4e5954f8bafeb018fd1ed0 guid: 0178734c2561b9a4eba97902b2338ce0
timeCreated: 1440338588 timeCreated: 1440352932
licenseType: Free licenseType: Free
TextureImporter: TextureImporter:
fileIDToRecycleName: {} fileIDToRecycleName: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2ce2dd05085d5f346bf7978c08cf9c2a guid: 6178327a280efa2458c291a7962e815f
timeCreated: 1440338588 timeCreated: 1440352932
licenseType: Free licenseType: Free
TextureImporter: TextureImporter:
fileIDToRecycleName: {} fileIDToRecycleName: {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,55 +0,0 @@
fileFormatVersion: 2
guid: fbc5a3f21b953ea4ca66189910320d64
timeCreated: 1440352933
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: 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: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,55 +0,0 @@
fileFormatVersion: 2
guid: bc957cb3031b7e849a0265eef1496b33
timeCreated: 1440352933
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: 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: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,55 +0,0 @@
fileFormatVersion: 2
guid: 6c5853d409a55a040802a54246c34e0d
timeCreated: 1440352933
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: 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: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,55 +0,0 @@
fileFormatVersion: 2
guid: 0178734c2561b9a4eba97902b2338ce0
timeCreated: 1440352932
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: 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: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,55 +0,0 @@
fileFormatVersion: 2
guid: 6178327a280efa2458c291a7962e815f
timeCreated: 1440352932
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: 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: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
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