void Start() { mainCharacter = MainCharacterControls.mainCharacter; playerAnimator = GetComponentInChildren <Animator>(); controller = GetComponent <Controller2D>(); pivot = transform.GetChild(0); gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2); jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; rollVelocity = (2 * rollDistance) / rollTime; rollBreakingAcceleration = -(rollVelocity / rollTime); pushTime = mainCharacter.stunTime * 0.8f; pushVelocity = (2 * pushDistance) / pushTime; pushBreakingAcceleration = -(pushVelocity / pushTime); Debug.Log("Breaking: " + rollBreakingAcceleration + " ,Velocity: " + rollVelocity); initScale = pivot.transform.localScale; //print ("Gravity: " + gravity + " Jump Velocity: " + jumpVelocity); }
private void Start() { collider = GetComponent <CompositeCollider2D>(); mainCharacter = MainCharacterControls.mainCharacter; playerCollider = mainCharacter.GetComponent <Collider2D>(); }
private void Awake() { mainCharacter = this; }