Exemplo n.º 1
0
    void Jump()
    {
        if (!isGrounded)
        {
            if (FacingAndTouchingWall() && UnlockTable.PowerActive(UnlockID.WallJump))
            {
                WallJump();
            }
            else if (UnlockTable.PowerActive(UnlockID.AirJump))
            {
                AirJump();
            }
            return;
        }
        //	float jumpForce = 400f;
        //	_rigidbody.AddForce(Vector3.up * jumpForce);
        _anim.PlayJumpSound();
        Vector3 vel = _rigidbody.velocity;

        vel.y = jumpSpeed;
        _rigidbody.velocity = vel;
        GameObject spark = Instantiate(GameController.instance.hitSparkPrefab);

        spark.transform.position = transform.position;
    }
Exemplo n.º 2
0
    void BasicMovement()
    {
        Vector3 moveInputs = Vector3.zero;

        moveInputs.x = VirtualController.GetAxisHorizontal();
        moveInputs.z = VirtualController.GetAxisVertical();
        _anim.SetMoving(moveInputs.x != 0);
        _anim.SetFacing(moveInputs.x);
        if (UnlockTable.PowerActive(UnlockID.Crouch))
        {
            _anim.SetCrouchInput(moveInputs.z < 0);
        }

        if (moveInputs.x != 0 && _rigidbody.velocity.x != 0)
        {
            _rigidbody.velocity = new Vector3(0, _rigidbody.velocity.y);
        }

        Vector3 movement = CheckMovement(moveInputs);

        Vector3 movepos = transform.position;

        movepos.x += movement.x;
        //movepos.z += movement.z;

        transform.position = movepos;
    }
Exemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     if (dashPauseTimer > 0)
     {
         dashPauseTimer     -= Time.deltaTime;
         _rigidbody.velocity = Vector3.zero;
         if (dashPauseTimer <= 0)
         {
             dashPauseTimer = 0;
             _anim.StopDashSlashAnim();
         }
         return;
     }
     if (wallJumpLockTimer > 0)
     {
         wallJumpLockTimer -= Time.deltaTime;
         if (wallJumpLockTimer <= 0)
         {
             wallJumpLockTimer = 0;
             Vector3 v = _rigidbody.velocity;
             v.x *= 0.65f;
             v.y *= 0.75f;
             _rigidbody.velocity = v;
         }
         return;
     }
     isGrounded = Grounded();
     _anim.SetGrounded(isGrounded);
     if (controlsLocked || hitstun)
     {
         return;
     }
     BasicMovement();
     if (VirtualController.JumpButtonPressed())
     {
         if (UnlockTable.PowerActive(UnlockID.Jump))
         {
             Jump();
         }
     }
     else if (!_anim.IsCrouching && VirtualController.ActionButtonPressed())
     {
         if (VirtualController.GetAxisHorizontal() != 0 && UnlockTable.PowerActive(UnlockID.DashSlash))
         {
             DashSlash(PMath.GetSign(VirtualController.GetAxisHorizontal()));
         }
         else if (UnlockTable.PowerActive(UnlockID.Slash))
         {
             Slash();
         }
     }
     if (isGrounded)
     {
         numAirJumps = maxAirJumps;
     }
     UpdateCoords();
 }
Exemplo n.º 4
0
 //public PaletteSprite[] palSprites;
 // Start is called before the first frame update
 void Start()
 {
     UpdateCount(itemCost);
     if(UnlockTable.PowerUnlocked(unlockID)){
         purchased = true;
         for(int i = 0; i < 3; i++){
             uiNumbers[i].SetEnabled(false);
         }
         if(unlockID == UnlockID.BlackMode || unlockID == UnlockID.BlueMode
         || unlockID == UnlockID.RedMode || unlockID == UnlockID.GreenMode ){
             iconPanel.sprite = inactivePanel;
         }
         else{
             iconPanel.sprite = UnlockTable.PowerActive(unlockID) ? activePanel : inactivePanel;
         }
     }
 }
Exemplo n.º 5
0
    public void AttemptPurchase()
    {
        SFXManager.PlayClickClip();
        if(purchased){
            bool b = UnlockTable.PowerActive(unlockID);
            //Debug.Log(b);
            SetSkillActive(!b);
            return;
        }

        if(itemCost <= SoulWallet.SoulCount){
            ConfirmPurchase();
        }
        if(GameController.DEBUG_MODE){
            ConfirmPurchase();
        }
    }
Exemplo n.º 6
0
 // Update is called once per frame
 void Update()
 {
     if (invulnTimer > 0)
     {
         invulnTimer            -= Time.deltaTime;
         _spriteRenderer.enabled = !_spriteRenderer.enabled;
         if (invulnTimer <= 0)
         {
             EndInvuln();
         }
     }
     if (trailTimer > 0)
     {
         trailTimer -= Time.deltaTime;
         float len = Mathf.Lerp(0, currentDashLength, trailTimer / trailDuration);
         dashTrail.transform.localScale = new Vector3(len, 1, 1);
         if (trailTimer <= 0)
         {
             trailTimer = 0;
             DisableTrail();
         }
     }
     if (!UnlockTable.PowerActive(UnlockID.Crouch))
     {
         crouchInput = false;
     }
     if (isCrouching)
     {
         if (!crouchInput && _movement.CanUncrouch())
         {
             Uncrouch();
         }
     }
     else
     {
         if (crouchInput)
         {
             Crouch();
         }
     }
 }