コード例 #1
0
        private void Update()
        {
            if (cell.vars.activeState == State.CONTROL)
            {
                if (cell.player.GetButton("Gun") && cell.vars.equippedBullet == BulletType.CHARGE && cell.vars.equippedGun == GunType.NORMAL)
                {
                    chargeValue      = Mathf.Min(chargeValue + Time.deltaTime, CHARGE_MAX);
                    chargeMultiplier = (chargeValue / (CHARGE_MAX));
                    gunImageObj.transform.localScale = new Vector3(chargeMultiplier * 0.2f + 1, chargeMultiplier * 0.2f + 1, 1);
                    // TODO: Add color and particle updater, add sounds
                }

                if (cell.player.GetButtonUp("Gun") || cell.player.GetButtonDown("Gun"))
                {
                    chargeMultiplier++;
                    cell.UpdateAnimations("attack");
                    cell.UpdateAnimations("shoot");

                    Shoot();

                    chargeValue      = 0;
                    chargeMultiplier = 0;
                    gunImageObj.transform.localScale = new Vector3(1, 1, 1);
                }
            }
        }
コード例 #2
0
 //Resets charge value, updates animations, sets attacking state, and clears attack buffer
 public void Attack()
 {
     hitObjects.Clear();
     cell.UpdateAnimations("attack");
     cell.UpdateAnimations("swing");
     chargeValue = 0;
     attacking   = true;
 }