Ejemplo n.º 1
0
        public override void Start()
        {
            this.gm = GameManager.Instance;

            if (this.gm.IsFromInitialize)
            {
                this.gm.playElapsedTime = 0;

                this.pl1SM  = this.gm.PL1Managers.stageManager;
                this.pl2SM  = this.gm.PL2Managers.stageManager;
                this.pl1PM  = this.gm.PL1Managers.playerManager;
                this.pl2PM  = this.gm.PL2Managers.playerManager;
                this.pl1EM  = this.gm.PL1Managers.enemyManager;
                this.pl2EM  = this.gm.PL2Managers.enemyManager;
                this.pl1PBM = this.gm.PL1Managers.playerBulletManager;
                this.pl2PBM = this.gm.PL2Managers.playerBulletManager;
                this.pl1EBM = this.gm.PL1Managers.enemyBulletManager;
                this.pl2EBM = this.gm.PL2Managers.enemyBulletManager;

                // BGM: StageBGM
                AudioManager.Instance.PlayBgm(this.gm.GetStageBGM());

                this.gm.IsFromInitialize = false;
            }
        }
Ejemplo n.º 2
0
        public RiaPlayer(GameObject _go, RiaCharacterScript _script, PlayerNumber _playerNumber) : base(_go, _script, _playerNumber)
        {
            // CharacterScriptの上書き
            this.Script = _script as RiaPlayerScript;

            // キャッシュ
            this.spRender        = this.Go.GetComponent <SpriteRenderer>();
            this.spRender.sprite = this.Script.Sprite;

            this.colliderSupporter = this.Actor.ColliderSupporter;

            this.circleCollider        = this.Go.GetComponent <CircleCollider2D>();
            this.circleCollider.radius = this.Script.CircleColliderRadius;
            this.animator = this.Actor.Animator;
            RiaSpriteAnimation[] anims =
            {
                GameObject.Instantiate <RiaSpriteAnimation>(this.Script.WaitAnimation),
                GameObject.Instantiate <RiaSpriteAnimation>(this.Script.RightGoAnimation),
                GameObject.Instantiate <RiaSpriteAnimation>(this.Script.LeftGoAnimation),
            };
            this.animator.SetAnimations(anims, this.Script.WaitAnimation.KeyName);

            this.bulletManger = null;

            this.rivalPlayer = null;

            // パラメータ
            /// 体力系
            this.HitPoint = this.Script.HitPointMax;

            /// 移動速度系
            this.MoveSpeedDebuffRate = 1.0f;

            /// タグ
            this.enemyTag = (this.PlayerNumber == PlayerNumber.player1) ?
                            TagEnum.Enemy1.ToDescription() :
                            TagEnum.Enemy2.ToDescription();
            this.enemyBulletTag = (this.PlayerNumber == PlayerNumber.player1) ?
                                  TagEnum.EnemyBullet1.ToDescription() :
                                  TagEnum.EnemyBullet2.ToDescription();

            /// 画面外処理
            this.areaLeftLine = (this.PlayerNumber == PlayerNumber.player1) ?
                                PlayableArea.pl1AreaLeftLine :
                                PlayableArea.pl2AreaLeftLine;
            this.areaRightLine = (this.PlayerNumber == PlayerNumber.player1) ?
                                 PlayableArea.pl1AreaRightLine :
                                 PlayableArea.pl2AreaRightLine;

            /// 無敵
            this.invincibleElapsedTime      = 0;
            this.invincibleBlinkingWaitTime = 0;
            this.sprCore         = this.Trans.GetChild(0).GetComponent <SpriteRenderer>();
            this.SpriteAlpha     = 1;
            this.CoreSpriteAlpha = 1;

            /// フレームレートとフレーム時間の算出 by flanny
            var frameRate = (float)Application.targetFrameRate;

            if (frameRate < 0)
            {
                frameRate = (QualitySettings.vSyncCount == 2) ? 30f : 60f;
            }
            var frameTime = 1.0f / frameRate;

            /// 次のコマへ進めるまでの待ち時間の設定 by flanny
            this.invincibleBlinkingWaitTimeMax =
                frameTime * this.Script.InvincibleBlinkingUpdateFrame;
        }