This commit is contained in:
Patrice Vignola 2015-08-22 17:30:11 -04:00
commit 9ce93ceca6
31 changed files with 305 additions and 21 deletions

View File

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

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.

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:

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:

View File

@ -25,22 +25,28 @@ public class AutoTarget : MonoBehaviour {
}
public Transform GetTarget(Vector3 lookingAngle) {
Transform closest = null;
float minAngle = minAngleRange;
Debug.Log("looking direction:" + lookingAngle);
foreach (Transform t in targets) {
Vector3 targetDirection = t.transform.position - transform.position;
float realAngle = Mathf.Atan2(targetDirection.z, targetDirection.x) * Mathf.Rad2Deg;
Debug.Log("real angle:" + realAngle);
float lookAngle = Mathf.Atan2(lookingAngle.z, lookingAngle.x) * Mathf.Rad2Deg;
Debug.Log("look angle:" + lookAngle);
float dot = Vector3.Dot(targetDirection, lookingAngle);
float angle = Mathf.Acos(dot) * Mathf.Rad2Deg;
if (angle < minAngle) {
minAngle = angle;
if (Mathf.Abs(lookAngle - realAngle) < minAngle) {
minAngle = lookAngle;
closest = t;
}
}
return closest;
}

View File

@ -75,9 +75,19 @@ public class ChildController : MonoBehaviour
}
if (xLookingValue != 0 || zLookingValue != 0) {
//transform.rotation = new Quaternion(0, 1, 0, Mathf.Atan2(zLookingValue, xLookingValue));
transform.eulerAngles = new Vector3(transform.eulerAngles.x, Mathf.Atan2(xLookingValue, zLookingValue) * Mathf.Rad2Deg, transform.eulerAngles.z);
_child.target = _autoTarget.GetTarget(new Vector3(xLookingValue, 0, zLookingValue));
Transform target = _autoTarget.GetTarget(new Vector3(xLookingValue, 0, zLookingValue));
_child.target = target;
if (_child.target != null) {
transform.LookAt(_child.target);
}
else {
transform.eulerAngles = new Vector3(
transform.eulerAngles.x,
Mathf.Atan2(xLookingValue, zLookingValue) * Mathf.Rad2Deg,
transform.eulerAngles.z);
}
}
}

View File

@ -2,6 +2,8 @@
using System.Collections;
public class Pillow : MonoBehaviour {
public bool IsThrown = false;
// Use this for initialization
void Start () {
@ -10,7 +12,20 @@ public class Pillow : MonoBehaviour {
// Update is called once per frame
void Update () {
if (transform.position.y < -10) {
Destroy(this.gameObject);
}
}
void OnTriggerEnter(Collider other) {
if (IsThrown && other.tag == "Player") {
Debug.Log("A child got hit by a pillow!");
//other.GetComponent<Child>().takeHit();
Destroy(this.gameObject);
}
}
}

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