This commit is contained in:
jparent 2016-01-30 17:35:06 -05:00
commit f731d34fda
8 changed files with 9007 additions and 86 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -18,19 +18,41 @@ public class Character : MonoBehaviour
private float dashRemainingTime = 0f;
private bool isDashing = false;
private int playerId;
private SelectorWithBolts selector;
private Vector3 dashForward;
public int PlayerID
{
get { return playerId; }
set { playerId = value; }
}
void Awake()
{
rb = GetComponent<Rigidbody>();
}
void Start()
{
selector = GameObject.FindObjectOfType<SelectorWithBolts>();
}
void Update()
{
Debug.Log(rb.velocity.magnitude);
if (dashRemainingTime > 0)
{
dashRemainingTime = Mathf.Clamp(dashRemainingTime - Time.deltaTime, 0f, DashCooldown);
}
if (!isDashing)
if (isDashing)
{
rb.AddForce(dashForward * DashForce, ForceMode.VelocityChange);
}
else
{
rb.rotation = Quaternion.RotateTowards(rb.rotation, targetRot, TurnSpeed * Time.deltaTime);
}
@ -78,9 +100,9 @@ public class Character : MonoBehaviour
{
isDashing = true;
Vector3 fwd = GetComponent<Transform>().forward;
dashForward = GetComponent<Transform>().forward;
rb.velocity = Vector3.zero;
rb.AddForce(fwd * DashForce, ForceMode.Impulse);
animator.SetTrigger("Dash");
yield return new WaitForSeconds(0.9f);

View File

@ -14,6 +14,8 @@ public class CharacterController : MonoBehaviour
InputManager.Instance.PushActiveContext("Normal", (int)playerNumber);
InputManager.Instance.AddCallback((int)playerNumber, HandlePlayerAxis);
InputManager.Instance.AddCallback((int)playerNumber, HandlePlayerButtons);
character.PlayerID = (int)playerNumber;
}
private void HandlePlayerAxis(MappedInput input)

View File

@ -0,0 +1,30 @@
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(Rigidbody))]
public class SelectorWithBolts : MonoBehaviour
{
public Transform[] Bolts;
public Transform[] RootCylinders;
private Rigidbody rb;
void Awake()
{
rb = GetComponent<Rigidbody>();
}
void Update()
{
for (int i = 0; i < RootCylinders.Length; i++)
{
Vector3 constraintPos = Bolts[i].position;
RootCylinders[i].position = constraintPos;
}
}
public void ApplyForce(int playerID, Vector3 force)
{
rb.AddForceAtPosition(force, Bolts[playerID].position);
}
}

View File

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

View File

@ -4,12 +4,12 @@
PhysicsManager:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Gravity: {x: 0, y: -9.81, z: 0}
m_Gravity: {x: 0, y: -9.81000042, z: 0}
m_DefaultMaterial: {fileID: 0}
m_BounceThreshold: 2
m_SleepThreshold: 0.005
m_DefaultContactOffset: 0.01
m_SleepThreshold: .00499999989
m_DefaultContactOffset: .00999999978
m_SolverIterationCount: 6
m_QueriesHitTriggers: 1
m_EnableAdaptiveForce: 0
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_LayerCollisionMatrix: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8fffffffefffffffaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

View File

@ -13,9 +13,9 @@ TagManager:
- UI
-
-
-
-
-
- Cylinder
- Character
- Ouija
-
-
-