Exemplo n.º 1
0
        }                                                                                                 // does not rotate (i.e. does not respect FacingDirectionInMillidegrees)

        public PlayerBullet(long xMillis, long yMillis, PlayerBulletType bulletType, DTImmutableList <ObjectBox> collisionBoxes)
        {
            this.xMillis         = xMillis;
            this.yMillis         = yMillis;
            this.bulletType      = bulletType;
            this._collisionBoxes = collisionBoxes;
        }
    public static IPlayerBulletCommand GetPlayerBulletType(PlayerBulletType type)
    {
        IPlayerBulletCommand command = null;

        switch (type) {
            case PlayerBulletType.TWO_WAY:
                command = new PlayerTwoWayBullet();
                break;
            case PlayerBulletType.WIDE_WAY:
                command = new PlayerWideWayBullet();
                break;
            case PlayerBulletType.SHELL:
                command = new PlayerShellBullet();
                break;
            case PlayerBulletType.THREE_WAY:
            default:
                command = new PlayerThreeWayBullet();
                break;
        }
        return command;
    }
Exemplo n.º 3
0
    void Update()
    {
        if (YkSys.Pose && this.enable) {
            float x = Input.GetAxisRaw("Horizontal");
            float y = Input.GetAxisRaw("Vertical");
            Vector2 direction = new Vector2(x, y).normalized;
            GetComponent<Rigidbody2D>().velocity = direction * speed;

            // 弾撃ち
            if (Input.GetKey(KeyCode.C) && timer >= (1.0f / (YkSys.playerParam.playerEnhanceShotSpeedPt > 0 ? YkSys.playerParam.playerEnhanceShotSpeedPt : 1))) {
                Shot();
                timer = 0;
            }

            // 弾切り替え
            if (Input.GetKeyDown(KeyCode.LeftControl)) {
                nowBulletType += 1;
                if (nowBulletType == PlayerBulletType.TWO_WAY) nowBulletType = PlayerBulletType.WIDE_WAY;
                if (nowBulletType > PlayerBulletType.SHELL) nowBulletType = PlayerBulletType.THREE_WAY;
            }

            timer += Time.deltaTime;

            // レーザー撃ち
            if (Input.GetKeyDown(KeyCode.D) && bulletGauge >= parent.bulletEnergyGauge.maxValue) {
                ShotLaser();
            }

            // オプション射出
            SetUpOption(Input.GetKey(KeyCode.X));
        } else {
            // 停止
            GetComponent<Rigidbody2D>().velocity = Vector2.zero;
        }

        // スコアはドラムロール式で増やす
        if (beforeScore < this.score) {
            beforeScore += Mathf.RoundToInt(beforeScore / this.score);
            parent.SetScoreText(beforeScore);
        }

        // 弾エネルギーを回復
        ChangeGaugeVal(Operator.PLUS);

        // オプションを回転
        RotOption();
    }