void Start () {
		anim 			 = GetComponent<Animator> ();
		collisions 	 	 = GetComponent<CollisionsController> ();
		wallInteractions = GetComponent<HitBox> ();
		currHp 			 = maxHp;
		currStamina 	 = maxStamina;
		gravity 	 	 = -(2 * maxJumpHeight) / Mathf.Pow (timeToJumpApex, 2);
		maxJumpVelocity  = Mathf.Abs (gravity) * timeToJumpApex; 	
		minJumpVelocity  = Mathf.Sqrt (2 * Mathf.Abs (gravity) * minJumpHeight);
		doInput = true;
	}
示例#2
0
 void Start()
 {
     genericController = GetComponent <CollisionsController>();
     myController      = GetComponent <PlayerController>();
     mainScript        = GetComponent <Player>();
     swordScript       = GetComponent <PlayerSwordAttack>();
     upperBodySprite   = transform.GetChild(0).GetChild(0);
     initialRot        = upperBodySprite.eulerAngles;
     initialLocalPos   = upperBodySprite.localPosition;
     anim     = upperBodySprite.GetComponent <Animator>();
     legsAnim = upperBodySprite.GetChild(0).GetComponent <Animator>();
 }
示例#3
0
 void Start()
 {
     myCollisions.Init();
     // justEnemy = LayerMask.GetMask("Enemy");
     defaultCollisionMask = collisionMask;
     // swordHitBox = transform.GetChild(0).GetChild(3).GetComponent<BoxCollider2D>();
     genericController = GetComponent <CollisionsController>();
     edgeGrabScript    = GetComponent <PlayerEdgeGrab>();
     mainScript        = GetComponent <Player>();
     rc1 = GetComponent <RaycastController>();
     rc1.Start();
     rc2 = transform.GetChild(0).GetChild(1).GetComponent <RaycastController>();
     rc2.Start();
     rc5 = transform.GetChild(0).GetChild(2).GetComponent <RaycastController>();
     rc5.Start();
     genericController.collisions.faceDir = 1;
 }
示例#4
0
    void Start()
    {
        flipTransform = transform.GetChild(0);
        anim          = flipTransform.GetChild(0).GetComponent <Animator>();
        legsAnim      = flipTransform.GetChild(0).GetChild(0).GetComponent <Animator>();
        upperSr       = flipTransform.GetChild(0).GetComponent <SpriteRenderer>();
        lowerSr       = flipTransform.GetChild(0).GetChild(0).GetComponent <SpriteRenderer>();
        defaultColor  = upperSr.color;

        genericController = GetComponent <CollisionsController>();
        myController      = GetComponent <PlayerController>();
        rollingScript     = GetComponent <PlayerRolling>();

        //kinematics
        gravity         = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2);
        maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
        minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight);
        print("Gravity: " + gravity + " Jump Velocity: " + maxJumpVelocity);
    }
	void Start () {
		collisions 	= GetComponent<CollisionsController> ();
	}