Compare commits
2 Commits
d9035be61b
...
36360d9dba
Author | SHA1 | Date | |
---|---|---|---|
|
36360d9dba | ||
|
9b7cd8f04d |
@ -318,6 +318,11 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Player
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7094923891560833916, guid: e4d82994b58b7304b91c915c597b71f8,
|
||||
type: 3}
|
||||
propertyPath: dashTime
|
||||
value: 0.2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7094923891560833916, guid: e4d82994b58b7304b91c915c597b71f8,
|
||||
type: 3}
|
||||
propertyPath: activeAbility.Array.size
|
||||
@ -326,7 +331,7 @@ PrefabInstance:
|
||||
- target: {fileID: 7094923891560833916, guid: e4d82994b58b7304b91c915c597b71f8,
|
||||
type: 3}
|
||||
propertyPath: activeAbility.Array.data[0]
|
||||
value: 3
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7094923891560833917, guid: e4d82994b58b7304b91c915c597b71f8,
|
||||
type: 3}
|
||||
|
@ -20,6 +20,10 @@ public class PlayerManager : MonoBehaviour
|
||||
public List<int> activeAbility = new List<int>(); //without ability=0 or null, dubleJump = 1, push/pull = 2, dash = 3
|
||||
private bool dubleJump = true;
|
||||
private GameObject pushPullObject;
|
||||
public float dashPower = 40f;
|
||||
public float dashTime = 0.2f;
|
||||
private float actualDashTime;
|
||||
private int dashButton;
|
||||
|
||||
private bool startEating = false;
|
||||
|
||||
@ -86,6 +90,45 @@ public class PlayerManager : MonoBehaviour
|
||||
);
|
||||
}
|
||||
}
|
||||
else if (activeAbility.Count > 0 && activeAbility[0] == 3)
|
||||
{
|
||||
if (Input.GetKeyUp(KeyCode.D) || Input.GetKeyUp(KeyCode.A)) {
|
||||
if (actualDashTime < Time.time)
|
||||
{
|
||||
if (Input.GetKeyUp(KeyCode.D))
|
||||
{
|
||||
dashButton = 1;
|
||||
}
|
||||
else if (Input.GetKeyUp(KeyCode.A))
|
||||
{
|
||||
dashButton = 2;
|
||||
}
|
||||
actualDashTime = Time.time + dashTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dashButton == 1 && Input.GetKeyUp(KeyCode.D)) {
|
||||
rigidBody.AddForce(
|
||||
(transform.right * dashPower * 10 * 5 * 1 * Time.deltaTime) +
|
||||
(transform.up * 1 * 10 * Time.deltaTime),
|
||||
ForceMode.VelocityChange
|
||||
);
|
||||
dashButton = 0;
|
||||
actualDashTime = Time.time - 1f;
|
||||
}
|
||||
else if (dashButton == 2 && Input.GetKeyUp(KeyCode.A))
|
||||
{
|
||||
rigidBody.AddForce(
|
||||
(transform.right * dashPower * 10 * 5 * -1 * Time.deltaTime) +
|
||||
(transform.up * 1 * 10 * Time.deltaTime),
|
||||
ForceMode.VelocityChange
|
||||
);
|
||||
dashButton = 0;
|
||||
actualDashTime = Time.time - 1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GameObject GetPushPullObject()
|
||||
|
Loading…
Reference in New Issue
Block a user