浏览代码

Moved around some stuff

/main
Ciro Continisio 4 年前
当前提交
d0592a4f
共有 4 个文件被更改,包括 820 次插入57 次删除
  1. 11
      Assets/Prefabs/Pig.prefab
  2. 4
      Assets/Prefabs/TreeRound.prefab
  3. 832
      Assets/Scenes/CharController.unity
  4. 30
      Assets/Scripts/Protagonist.cs

11
Assets/Prefabs/Pig.prefab


m_Name:
m_EditorClassIdentifier:
inputReader: {fileID: 0}
speed: 10
airMomentumMultiplier: 3
jumpStrength: 1
speed: 8
gravityMultiplier: 5
initialJumpForce: 8
jumpInputDuration: 0.4
maxFallSpeed: 50
gravityContributionMultiplier: 0
gravityDivider: 0.6
gravityComebackMultiplier: 15
--- !u!136 &3341179906418240730
CapsuleCollider:
m_ObjectHideFlags: 0

4
Assets/Prefabs/TreeRound.prefab


- target: {fileID: -8679921383154817045, guid: c776f5f6bce58524788dbb1dbf44dc32,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.037068937
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c776f5f6bce58524788dbb1dbf44dc32,
type: 3}

- target: {fileID: -8679921383154817045, guid: c776f5f6bce58524788dbb1dbf44dc32,
type: 3}
propertyPath: m_LocalPosition.z
value: 0.13883056
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c776f5f6bce58524788dbb1dbf44dc32,
type: 3}

832
Assets/Scenes/CharController.unity
文件差异内容过多而无法显示
查看文件

30
Assets/Scripts/Protagonist.cs


public InputReader inputReader;
private CharacterController characterController;
public float speed = 10f;
public float gravityMultiplier = 5f;
public float initialJumpForce = 10f;
public float jumpInputDuration = .4f;
public float speed = 10f; //Horizontal plane speed multiplier
public float gravityMultiplier = 5f; //General multiplier for gravity (affects jump and freefall)
public float initialJumpForce = 10f; //The initial upwards push when pressing jump. This is injected into verticalMovement, and gradually cancelled by gravity
public float jumpInputDuration = .4f; //How long can the player hold the jump button
public float gravityComebackMultiplier = 15f; //Represents how fast gravityContributionMultiplier will go back to 1f. The higher, the faster
public float maxFallSpeed = 50f; //The maximum speed reached when falling (in units/frame)
public float gravityDivider = .6f; //Each frame while jumping, gravity will be multiplied by this amount in an attempt to "cancel it" (= jump higher)
public float maxFallSpeed = 50f;
[SerializeField] private float gravityContributionMultiplier = 0f;
[SerializeField] private float gravityDivider = .7f;
[SerializeField] private float gravityComebackMultiplier = 5f;
private bool isJumping = false;
private float jumpBeginTime = -Mathf.Infinity;
private float verticalMovement = 0f;
private Vector3 movementVector;
private Vector3 inputVector;
private float gravityContributionMultiplier = 0f; //The factor which determines how much gravity is affecting verticalMovement
private bool isJumping = false; //If true, a jump is in effect and the player is holding the jump button
private float jumpBeginTime = -Mathf.Infinity; //Time of the last jump
private float verticalMovement = 0f; //Represents how much a player will move vertically in a frame. Affected by gravity * gravityContributionMultiplier
private Vector3 inputVector; //Initial input horizontal movement (y == 0f)
private Vector3 movementVector; //Final movement vector
//Adds listeners for events being triggered in the InputReader script
private void OnEnable()

//Removes all listeners to the events coming from the InputReader script
private void OnDisable()
{
inputReader.jumpEvent -= OnJumpInitiated;
inputReader.jumpCanceledEvent -= OnJumpCanceled;
inputReader.moveEvent -= OnMove;
//...
}

正在加载...
取消
保存