Some Power edit
This commit is contained in:
parent
bda2349e16
commit
86db826a77
@ -30,7 +30,7 @@ Transform:
|
||||
m_GameObject: {fileID: 7120608647080996497}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 4.67, y: 0.76, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_LocalScale: {x: 1.2, y: 1.2, z: 1.2}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
@ -104,13 +104,13 @@ Rigidbody:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7120608647080996497}
|
||||
serializedVersion: 2
|
||||
m_Mass: 70
|
||||
m_Mass: 80
|
||||
m_Drag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_UseGravity: 1
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 120
|
||||
m_Constraints: 122
|
||||
m_CollisionDetection: 0
|
||||
--- !u!114 &7120608647080996507
|
||||
MonoBehaviour:
|
||||
@ -125,3 +125,5 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
objectType: 1
|
||||
detailSign: {fileID: 0}
|
||||
MovePoints: []
|
||||
|
@ -591,31 +591,11 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: PushPullCube
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7120608647080996502, guid: 597897b562955934fae65d62e0a8e3cd,
|
||||
type: 3}
|
||||
propertyPath: m_Mass
|
||||
value: 10000
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 6
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 1.2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1.2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 1.2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
@ -1619,7 +1599,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1663971021}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -3.51, y: 2.2, z: 0}
|
||||
m_LocalPosition: {x: -3.51, y: 2.31, z: 0}
|
||||
m_LocalScale: {x: 2, y: 1.8, z: 2}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
|
@ -118,6 +118,23 @@ public class ObjectManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (other.gameObject.tag == "Player")
|
||||
{
|
||||
if (objectType == ObjectType.Ladder)
|
||||
{
|
||||
playerManager = other.gameObject.GetComponent<PlayerManager>();
|
||||
if (playerManager.activeAbility.Count > 0 && playerManager.activeAbility[0] == 4)
|
||||
{
|
||||
playerManager.onLadder = true;
|
||||
playerManager.GetComponent<Rigidbody>().useGravity = false;
|
||||
interact = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.gameObject.tag == "Player")
|
||||
|
@ -27,11 +27,13 @@ public class PlayerManager : MonoBehaviour
|
||||
public Image powerImage;
|
||||
private bool dubleJump = true;
|
||||
private GameObject pushPullObject;
|
||||
private float pushPullObjectDistance;
|
||||
public float dashPower = 40f;
|
||||
public float dashTime = 0.2f;
|
||||
private float actualDashTime;
|
||||
private int dashButton;
|
||||
private bool dash = false;
|
||||
private bool cannotMove = false;
|
||||
|
||||
private bool startEating = false;
|
||||
|
||||
@ -67,6 +69,7 @@ public class PlayerManager : MonoBehaviour
|
||||
}
|
||||
if (actualHealth <= 0 || gameObject.transform.position.y < -400.0f)
|
||||
{
|
||||
cannotMove = true;
|
||||
playerAnimator.Play("Die");
|
||||
}
|
||||
if (interact)
|
||||
@ -87,9 +90,11 @@ public class PlayerManager : MonoBehaviour
|
||||
}
|
||||
AbilityAction();
|
||||
DeactivePowerCube();
|
||||
if (!cannotMove) {
|
||||
Move();
|
||||
RunSwitch();
|
||||
Animation();
|
||||
}
|
||||
|
||||
if (startEating)
|
||||
{
|
||||
@ -106,9 +111,12 @@ public class PlayerManager : MonoBehaviour
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (!cannotMove && !onLadder)
|
||||
{
|
||||
Jump();
|
||||
}
|
||||
}
|
||||
|
||||
private void AbilityAction()
|
||||
{
|
||||
@ -116,11 +124,21 @@ public class PlayerManager : MonoBehaviour
|
||||
{
|
||||
if (pushPullObject != null)
|
||||
{
|
||||
float distance = Vector3.Distance(pushPullObject.transform.position, gameObject.transform.position);
|
||||
if (pushPullObjectDistance - 0.1f <= distance && pushPullObjectDistance + 0.1f >= distance)
|
||||
{
|
||||
Rigidbody pcmRigidB = pushPullObject.GetComponent<Rigidbody>();
|
||||
pcmRigidB.constraints = RigidbodyConstraints.FreezeRotation;
|
||||
pushPullObject.GetComponent<Rigidbody>().MovePosition(
|
||||
pushPullObject.transform.position +
|
||||
(pushPullObject.transform.right * (run ? runSpeed : speed) * Input.GetAxis("Horizontal") * Time.deltaTime)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
RemovePushPullObject();
|
||||
}
|
||||
}
|
||||
powerImage.sprite = powerIcons[1];
|
||||
}
|
||||
else if (activeAbility.Count > 0 && activeAbility[0] == 3)
|
||||
@ -185,14 +203,22 @@ public class PlayerManager : MonoBehaviour
|
||||
public void SetPushPullObject(GameObject objectPP)
|
||||
{
|
||||
if (activeAbility.Count > 0 && activeAbility[0] == 2) {
|
||||
if (pushPullObject != null)
|
||||
{
|
||||
pushPullObject.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezePositionX;
|
||||
}
|
||||
pushPullObject = objectPP;
|
||||
pushPullObjectDistance = Vector3.Distance(pushPullObject.transform.position, gameObject.transform.position);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemovePushPullObject()
|
||||
{
|
||||
if (pushPullObject != null) {
|
||||
pushPullObject.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezePositionX;
|
||||
pushPullObject = null;
|
||||
}
|
||||
}
|
||||
|
||||
void RunSwitch()
|
||||
{
|
||||
@ -326,16 +352,6 @@ public class PlayerManager : MonoBehaviour
|
||||
transform.localScale.y + savePower,
|
||||
transform.localScale.z + savePower
|
||||
);
|
||||
/*transform.localScale = new Vector3(
|
||||
transform.localScale.x + power,
|
||||
transform.localScale.y + power,
|
||||
transform.localScale.z + power
|
||||
);*/
|
||||
/*transform.localPosition = new Vector3(
|
||||
transform.localPosition.x,
|
||||
transform.localPosition.y + power * 2,
|
||||
transform.localPosition.z
|
||||
);*/
|
||||
|
||||
}
|
||||
else if (powerType == PowerCubeManager.PowerType.Faster)
|
||||
@ -464,11 +480,13 @@ public class PlayerManager : MonoBehaviour
|
||||
|
||||
public void StartEatPowerCube()
|
||||
{
|
||||
cannotMove = true;
|
||||
startEating = true;
|
||||
}
|
||||
|
||||
public void EndEatPowerCube()
|
||||
{
|
||||
cannotMove = false;
|
||||
startEating = false;
|
||||
ActivePowerCube(powerCubeManager.powerUnit, powerCubeManager.powerTime, powerCubeManager.powerType, powerCubeManager.nextSceneName);
|
||||
Destroy(powerCubeManager.gameObject);
|
||||
|
@ -58,6 +58,7 @@ public class PowerCubeManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.gameObject.tag == "Player")
|
||||
|
Loading…
Reference in New Issue
Block a user