mirror of
https://github.com/ConjureETS/PillowFight.git
synced 2026-03-24 00:50:59 +00:00
Added pillow hits
Signed-off-by: RosimInc <rosim_inc@hotmail.com>
This commit is contained in:
parent
6ce7a9b8ab
commit
6eae91f4d5
@ -47,13 +47,12 @@ public class AutoTarget : MonoBehaviour
|
||||
|
||||
public Transform GetTarget(Vector3 lookingAngle)
|
||||
{
|
||||
return GetTarget(lookingAngle, 2000);
|
||||
return GetTarget(lookingAngle, 2000, minAngleRange);
|
||||
}
|
||||
|
||||
public Transform GetTarget(Vector3 lookingAngle, float range)
|
||||
public Transform GetTarget(Vector3 lookingAngle, float range, float minAngle)
|
||||
{
|
||||
Transform closest = null;
|
||||
float minAngle = minAngleRange;
|
||||
Transform closest = null;
|
||||
float rangeSq = range * range;
|
||||
|
||||
//Debug.Log("looking direction:" + lookingAngle);
|
||||
@ -63,6 +62,7 @@ public class AutoTarget : MonoBehaviour
|
||||
foreach (Transform t in targets)
|
||||
{
|
||||
Vector3 targetDirection = t.transform.position - transform.position;
|
||||
Debug.Log(targetDirection.magnitude);
|
||||
if (targetDirection.sqrMagnitude > rangeSq)
|
||||
continue;
|
||||
|
||||
|
||||
@ -7,7 +7,8 @@ public class Child : MonoBehaviour
|
||||
public float Speed = 10f;
|
||||
public float JumpForce = 10f;
|
||||
public float MaxInvulnerableTime = 2f;
|
||||
public float ThrowForce = 30f;
|
||||
public float ThrowForce = 30f;
|
||||
public float HitForce = 3f;
|
||||
public float hitPushBackForce = 250f;
|
||||
public float yAngleVector = 9f;
|
||||
|
||||
@ -235,8 +236,10 @@ public class Child : MonoBehaviour
|
||||
|
||||
public void Swing()
|
||||
{
|
||||
if (pillow == null) return;
|
||||
|
||||
//1. Determine if there is someone in front
|
||||
Transform t = null;//_autoTarget.GetTarget(transform.forward, 0.9f);
|
||||
Transform t = _autoTarget.GetTarget(transform.forward, 1.2f, 30);
|
||||
|
||||
if(t == null)
|
||||
return;
|
||||
@ -246,7 +249,7 @@ public class Child : MonoBehaviour
|
||||
|
||||
direction = direction.normalized;
|
||||
|
||||
t.gameObject.GetComponent<Child>().Push(direction * ThrowForce);
|
||||
t.gameObject.GetComponent<Child>().Push(direction * HitForce);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -94,11 +94,10 @@ public class ChildController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
//if (input.Ranges.ContainsKey("Throw")) {
|
||||
// _child.Throw();
|
||||
//}
|
||||
if (input.Ranges.ContainsKey("Throw"))
|
||||
_child.Throw();
|
||||
|
||||
if (input.Ranges.ContainsKey("Throw"))
|
||||
if (input.Ranges.ContainsKey("Hit"))
|
||||
_child.Swing();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user