mirror of
https://github.com/ConjureETS/PillowFight.git
synced 2026-03-24 00:50:59 +00:00
Fix a bug in the pillow spawner script
This commit is contained in:
parent
f94cca5844
commit
f6ae2d05c0
@ -41,6 +41,11 @@ public class Bed : MonoBehaviour
|
||||
_nextSpawnDelay = GetNextSpawnDelay();
|
||||
}
|
||||
}
|
||||
else if (_currentPillow.IsOwned)
|
||||
{
|
||||
_currentPillow = null;
|
||||
_elapsedTime = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
private void SpawnPillow()
|
||||
@ -89,17 +94,6 @@ public class Bed : MonoBehaviour
|
||||
_isTaken = false;
|
||||
}
|
||||
|
||||
void OnCollisionExit(Collision col)
|
||||
{
|
||||
Debug.Log(_currentPillow != null && col.gameObject == _currentPillow.gameObject);
|
||||
|
||||
if (_currentPillow != null && col.gameObject == _currentPillow.gameObject)
|
||||
{
|
||||
_currentPillow = null;
|
||||
_elapsedTime = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void OnCollisionEnter(Collision col)
|
||||
{
|
||||
|
||||
@ -66,6 +66,7 @@ public class Child : MonoBehaviour
|
||||
pillow.transform.parent = transform; // make the pillow a child of Child
|
||||
pillow.transform.localPosition = new Vector3(0f, 1.5f, 0f);
|
||||
pillow.GetComponent<Rigidbody>().isKinematic = true; // dont make pillow obey to gravity when in a child's hands
|
||||
pillow.IsOwned = true;
|
||||
|
||||
// TODO: place the pillow correctly or animate or something...
|
||||
}
|
||||
@ -189,6 +190,8 @@ public class Child : MonoBehaviour
|
||||
|
||||
pillow.Throw(direction * ThrowForce);
|
||||
|
||||
pillow.IsOwned = false;
|
||||
|
||||
pillow = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,13 @@ public class Pillow : MonoBehaviour {
|
||||
private Collider _col;
|
||||
private Rigidbody _rb;
|
||||
|
||||
private bool _isOwned;
|
||||
|
||||
public bool IsOwned
|
||||
{
|
||||
get { return _isOwned; }
|
||||
set { _isOwned = value; }
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user