Esempio n. 1
0
        //加载任务(游戏主核心)
        void AddCommands()
        {
            TCset leftOut_120 = new TCset(120 + 300, "leftOut_120", false);

            Stage1_SystemCommands.Add(leftOut_120);
            TCset rightOut_120 = new TCset(240 + 300 + 80, "rightOut_120", false);

            Stage1_SystemCommands.Add(rightOut_120);
            TCset leftOut_240 = new TCset(240 + 300, "leftOut_240", false);

            Stage1_SystemCommands.Add(leftOut_240);
            TCset rightOut_240 = new TCset(240 + 300 + 40, "rightOut_240", false);

            Stage1_SystemCommands.Add(rightOut_240);

            TCset left_loop = new TCset(1200, 2000, "leftloop", false, true);

            Stage1_SystemCommands.Add(left_loop);
            TCset right_loop = new TCset(1200, 2000, "rightloop", false, true);

            Stage1_SystemCommands.Add(right_loop);

            //120帧后显示BGM
            TCset ShowBGM = new TCset(120, "ShowBGM1", false);

            Stage1_SystemCommands.Add(ShowBGM);
            TCset BackSpeedChange1 = new TCset(350, "BackSpeedChange1", false);

            Stage1_SystemCommands.Add(BackSpeedChange1);
            TCset BackSpeedChange2 = new TCset(700, "BackSpeedChange2", false);

            Stage1_SystemCommands.Add(BackSpeedChange2);
        }
Esempio n. 2
0
        public Stage01_E01c(EnemyData edt,bool _turnleft = false)
        {
            turnleft = _turnleft;
            enemydata = edt;
            enemydata.Speed = 150;
            direction = enemydata.Direction;
            position = enemydata.Position;
            direction.X = 0;
            direction.Y = -1;

            TCset godir = new TCset(0,200);                  //0-200帧行走直线并且进行减速
            godir.Name = "godir";
            commands.Add(godir);

            TCset rotate = new TCset(500, 580);              //500-580帧时进行旋转,并且进行加速
            rotate .Name =  "rotate";
            commands .Add(rotate);
        }
Esempio n. 3
0
        public Stage01_E01c(EnemyData edt, bool _turnleft = false)
        {
            turnleft        = _turnleft;
            enemydata       = edt;
            enemydata.Speed = 150;
            direction       = enemydata.Direction;
            position        = enemydata.Position;
            direction.X     = 0;
            direction.Y     = -1;

            TCset godir = new TCset(0, 200);                  //0-200帧行走直线并且进行减速

            godir.Name = "godir";
            commands.Add(godir);

            TCset rotate = new TCset(500, 580);              //500-580帧时进行旋转,并且进行加速

            rotate.Name = "rotate";
            commands.Add(rotate);
        }
Esempio n. 4
0
        public RedButterflyEnemy(TextureManager texturemanager, float x, float y, bool il)
        {
            this.texturemanager = texturemanager;
            name       = "RedButterflyEnemy";
            Position.X = x; Position.Y = y;
            enemybody  = new RedButterfly(texturemanager, (float)Position.X, (float)Position.Y, speed); //填装DrakBlueSprite的身体(纹理)数据
            enemybody.multiSprite.State              = 0;                                               //拨起0号动画
            enemybody.multiSprites[1].State          = 0;                                               //拨起身体的0号动画
            enemybody.multiSprites[1].changeinterval = 0.1f;
            enemybody.multiSprite.changeinterval     = 0.1f;
            Direction = new Vector2D(0, -1);

            isleft      = il;
            hp          = 20000; //20w血量
            renderlevel = 2;     //画在最顶层

            rotateTcset = new TCset(0.1f);
            fireTcset   = new TCset(0.3f);
            TCsets      = new List <TCset>();
            TCsets.Add(rotateTcset);
            TCsets.Add(fireTcset);
        }
Esempio n. 5
0
        List <TCset> TCsets;       //处理器的集合

        public override void Update(double elapsedTime)
        {
            base.Update(elapsedTime);
            enemybody.Update(elapsedTime, Position.X, Position.Y);

            double littleoffset = 1;
            bool   have         = false;

            for (int i = 0; i < TCsets.Count; i++)
            {
                TCset st = TCsets[i];
                if (st.useable)
                {
                    st.AddTime(elapsedTime);
                    if (st.caculateTime >= st.interval)
                    {
                        double offset = st.caculateTime - st.interval;
                        if (littleoffset > offset)
                        {
                            littleoffset = offset;         //找到最小的offset值
                        }
                        have = true;
                    }
                }
            }
            if (have)
            {
                for (int i = 0; i < TCsets.Count; i++)
                {
                    TCset cmd = TCsets[i];
                    if (cmd.useable)
                    {
                        if (cmd.caculateTime - cmd.interval == littleoffset)
                        {
                            if (i == 1)     //fire
                            {
                                if (living)
                                {
                                    Fire();
                                }
                                //System.Diagnostics.Debug.Print("cmd.caculate: "+ cmd.caculateTime.ToString()+
                                //    "  fire time: " + Stage1State.GameTime.ToString()
                                //    + " \nelapsedtime : "+ elapsedTime.ToString()
                                //    + " offset :"+ littleoffset.ToString());
                                // System.Diagnostics.Debug.Print(Position.ToString());
                            }
                            if (i == 0)     //rotate
                            {
                                if (isleft)
                                {
                                    Direction.rotate(10);
                                }
                                else
                                {
                                    Direction.rotate(-10);
                                }
                            }
                            cmd.ClearTime();                                    //需要执行的任务就清空计时器
                        }
                        else
                        {
                            cmd.caculateTime -= (elapsedTime - littleoffset);   //不需执行的任务则需要返回应用的逻辑时间(减去后置误差值)
                        }
                    }
                }
                needReupdate = true;
                ReupdateTime = littleoffset;
            }

            if (needReupdate)
            {
                needReupdate = false;
                Update(ReupdateTime);
            }
            else
            {
                EntitiesUpdate(elapsedTime);
            }
        }
Esempio n. 6
0
        public void Start()
        {
            _soundmanager.Play("rj");
            _particles      = new Particle.FlyingFlowersParticles(_textureManager);
            _breakParticles = new Particle.BreakPointsParticles(_textureManager);
            background      = new BackGround(_textureManager, 0, _particles); //着色等级为0级(顶层着色)
            background.BindParticle(_breakParticles);                         //绑定粒子

            background.Start();
            foretable.Start();
            gameview.Start();
            GamePlayer.Start();

            Hp       = Datas.Hp_Start;
            Datas.Hp = Hp;
            Booms    = Datas.booms;

            Datas.CurrentEnemys  = Enemys;                     //将全局的CurrentEnemys指向此场景上(便于)
            Datas.CurrentItemAdd = Items_toAdd;                //将全局道具列表切换到此状态
            Datas.CurrentPlayer  = GamePlayer;                 //当前玩家

            GameTime = 0;                                      //初始化游戏时间

            //重播模式
            if (Datas.ReFre)
            {
                #region
                Datas.ReadData();
                commands.Clear();
                foreach (string str in Datas.Commands)
                {
                    char[] arr = str.ToCharArray();
                    int    st = 0, ct = 0;
                    for (int i = 0; i < arr.Length; i++)
                    {
                        if (arr[i] == '$')
                        {
                            st = i;
                        }
                        if (arr[i] == '#')
                        {
                            ct = i;
                        }
                    }
                    string name  = str.Substring(st + 1, ct - st - 1);
                    string value = str.Substring(ct + 1);
                    double time  = Convert.ToDouble(value);
                    switch (name)
                    {
                    case "Seed":
                        int seed = (int)time;
                        Datas.GameRandom = new GRandom(seed);
                        break;

                    case "LeftDown":
                        TCset tcset = new TCset();
                        tcset.Name         = "LeftDown";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "LeftUp":
                        tcset              = new TCset();
                        tcset.Name         = "LeftUp";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "RightDown":
                        tcset              = new TCset();
                        tcset.Name         = "RightDown";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "RightUp":
                        tcset              = new TCset();
                        tcset.Name         = "RightUp";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "UpUp":
                        tcset              = new TCset();
                        tcset.Name         = "UpUp";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "UpDown":
                        tcset              = new TCset();
                        tcset.Name         = "UpDown";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "DownDown":
                        tcset              = new TCset();
                        tcset.Name         = "DownDown";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "DownUp":
                        tcset              = new TCset();
                        tcset.Name         = "DownUp";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "ShiftUp":
                        tcset              = new TCset();
                        tcset.Name         = "ShiftUp";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "ShiftDown":
                        tcset              = new TCset();
                        tcset.Name         = "ShiftDown";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "ZDown":
                        tcset              = new TCset();
                        tcset.Name         = "ZDown";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "ZUp":
                        tcset              = new TCset();
                        tcset.Name         = "ZUp";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;
                    }
                    #endregion
                }
            }
            //非重播模式
            else
            {
                Datas.GameRandom = new GRandom();
                Datas.Commands   = new List <string>();
                Datas.Commands.Add("$Seed#" + Datas.GameRandom.Seed.ToString());
            }

            GameTime = 0;
            Stage1_SystemCommands.Clear();
            AddCommands();                //添加按键命令

            background.SpeedY = 0.01f;    //初始速度

            gameview.BeginStart();        //开始执行
            //gameview.ShowBGM("BGM:Silent Story(發熱巫女~ず)", 0.4f);      //显示BGM, 字体倍率为0.5f
            _soundmanager.SetVolumChannel("Graze", 0.2f);
        }
Esempio n. 7
0
        Vector2D vct; //用于存放指向敌人的主方向

        #endregion Fields

        #region Constructors

        public Stage01_E01(TextureManager _texturemanager, float x, float y,bool _turnleft = false)
        {
            name = "Stage01_E01";
            texturemanager = _texturemanager;
            Position.X = x; Position.Y = y;
            enemybody = new DarkBlueLittleSprite(texturemanager);   //皮肤选择为DarkBlueLittleSprite
            enemybody.multiSprite.State = 0;                        //一开始先重置为一般状态
            hp = 1500;
            enemydata = new EnemyData(Position, Direction, Scale, 100);    //建立一个敌人数据,用于传递给行为控制器使用
            turnleft = _turnleft;
            controler = new Stage01_E01c(enemydata,turnleft);                        //建立一个专属的行为控制器
            renderlevel = 0;                                 //在敌人列表中置于最底层

            Break_ani = new BreakOut_Blue(_texturemanager, Position,20,16,64);       //爆炸动画
            breakParticle = new Particle.BreakPointsParticles(_texturemanager, 0);   //溅射粒子
            breakParticle.EnableVisibleLenth(true, 5);

            TCset fire01 = new TCset(50, 250);              //200-500帧第一阶段释放子弹
            fire01.Name = "fire01";
            commands.Add(fire01);                            //添加进任务队列
            TCset fire02 = new TCset(250, 400);              //500-580帧时进行旋转,并且进行加速
            fire02.Name = "fire02";
            commands.Add(fire02);
            TCset stop01 = new TCset(320, 340);              //中间过程停止发射(stop要置于fire等命令的后面)
            stop01.Name = "stop01";
            commands.Add(stop01);
        }
Esempio n. 8
0
        //加载任务(游戏主核心)
        void AddCommands()
        {
            TCset leftOut_120 = new TCset(120 + 300,"leftOut_120",false);
            Stage1_SystemCommands.Add(leftOut_120);
            TCset rightOut_120 = new TCset(240 + 300+80, "rightOut_120", false);
            Stage1_SystemCommands.Add(rightOut_120);
            TCset leftOut_240 = new TCset(240 + 300, "leftOut_240", false);
            Stage1_SystemCommands.Add(leftOut_240);
            TCset rightOut_240 = new TCset(240 + 300+40, "rightOut_240", false);
            Stage1_SystemCommands.Add(rightOut_240);

            TCset left_loop = new TCset(1200,2000, "leftloop", false, true);
            Stage1_SystemCommands.Add(left_loop);
            TCset right_loop = new TCset(1200, 2000, "rightloop", false, true);
            Stage1_SystemCommands.Add(right_loop);

            //120帧后显示BGM
            TCset ShowBGM = new TCset(120, "ShowBGM1", false);
            Stage1_SystemCommands.Add(ShowBGM);
            TCset BackSpeedChange1 = new TCset(350, "BackSpeedChange1", false);
            Stage1_SystemCommands.Add(BackSpeedChange1);
            TCset BackSpeedChange2 = new TCset(700, "BackSpeedChange2", false);
            Stage1_SystemCommands.Add(BackSpeedChange2);
        }
Esempio n. 9
0
        public void Start()
        {
            _soundmanager.Play("rj");
            _particles = new Particle.FlyingFlowersParticles(_textureManager);
            _breakParticles = new Particle.BreakPointsParticles(_textureManager);
            background = new BackGround(_textureManager, 0, _particles);        //着色等级为0级(顶层着色)
            background.BindParticle(_breakParticles);            //绑定粒子

            background.Start();
            foretable.Start();
            gameview.Start();
            GamePlayer.Start();

            Hp = Datas.Hp_Start;
            Datas.Hp = Hp;
            Booms = Datas.booms;

            Datas.CurrentEnemys = Enemys;                      //将全局的CurrentEnemys指向此场景上(便于)
            Datas.CurrentItemAdd = Items_toAdd;                //将全局道具列表切换到此状态
            Datas.CurrentPlayer = GamePlayer;                  //当前玩家

            GameTime = 0;                                      //初始化游戏时间

            //重播模式
            if (Datas.ReFre)
            {
                #region
                Datas.ReadData();
                commands.Clear();
                foreach (string str in Datas.Commands)
                {
                    char[] arr = str.ToCharArray();
                    int st =0, ct=0;
                    for (int i = 0; i < arr.Length; i++)
                    {
                        if (arr[i] == '$')
                            st = i;
                        if (arr[i] == '#')
                            ct = i;
                    }
                    string name = str.Substring(st+1, ct - st - 1);
                    string value = str.Substring(ct + 1);
                    double time = Convert.ToDouble(value);
                    switch (name)
                    {
                        case "Seed":
                            int seed = (int)time;
                            Datas.GameRandom = new GRandom(seed);
                            break;
                        case "LeftDown" :
                            TCset tcset = new TCset();
                            tcset.Name = "LeftDown";
                            tcset.caculateTime = time;
                            commands.Add(tcset);
                            break;
                        case "LeftUp":
                            tcset = new TCset();
                            tcset.Name = "LeftUp";
                            tcset.caculateTime = time;
                            commands.Add(tcset);
                            break;
                        case "RightDown":
                            tcset = new TCset();
                            tcset.Name = "RightDown";
                            tcset.caculateTime = time;
                            commands.Add(tcset);
                            break;
                        case "RightUp":
                            tcset = new TCset();
                            tcset.Name = "RightUp";
                            tcset.caculateTime = time;
                            commands.Add(tcset);
                            break;
                        case "UpUp":
                            tcset = new TCset();
                            tcset.Name = "UpUp";
                            tcset.caculateTime = time;
                            commands.Add(tcset);
                            break;
                        case "UpDown":
                            tcset = new TCset();
                            tcset.Name = "UpDown";
                            tcset.caculateTime = time;
                            commands.Add(tcset);
                            break;
                        case "DownDown":
                            tcset = new TCset();
                            tcset.Name = "DownDown";
                            tcset.caculateTime = time;
                            commands.Add(tcset);
                            break;
                        case "DownUp":
                            tcset = new TCset();
                            tcset.Name = "DownUp";
                            tcset.caculateTime = time;
                            commands.Add(tcset);
                            break;
                        case "ShiftUp":
                            tcset = new TCset();
                            tcset.Name = "ShiftUp";
                            tcset.caculateTime = time;
                            commands.Add(tcset);
                            break;
                        case "ShiftDown":
                            tcset = new TCset();
                            tcset.Name = "ShiftDown";
                            tcset.caculateTime = time;
                            commands.Add(tcset);
                            break;
                        case "ZDown":
                            tcset = new TCset();
                            tcset.Name = "ZDown";
                            tcset.caculateTime = time;
                            commands.Add(tcset);
                            break;
                        case "ZUp":
                            tcset = new TCset();
                            tcset.Name = "ZUp";
                            tcset.caculateTime = time;
                            commands.Add(tcset);
                            break;
                    }
                #endregion
                }
            }
            //非重播模式
            else
            {
                Datas.GameRandom = new GRandom();
                Datas.Commands = new List<string>();
                Datas.Commands.Add("$Seed#" + Datas.GameRandom.Seed.ToString());
            }

            GameTime = 0;
            Stage1_SystemCommands.Clear();
            AddCommands();                                   //添加按键命令

            background.SpeedY = 0.01f;     //初始速度

            gameview.BeginStart();        //开始执行
            //gameview.ShowBGM("BGM:Silent Story(發熱巫女~ず)", 0.4f);      //显示BGM, 字体倍率为0.5f
            _soundmanager.SetVolumChannel("Graze", 0.2f);
        }
Esempio n. 10
0
        public RedButterflyEnemy(TextureManager texturemanager ,float x, float y, bool il)
        {
            this.texturemanager = texturemanager;
            name = "RedButterflyEnemy";
            Position.X = x; Position.Y = y;
            enemybody = new RedButterfly(texturemanager,(float)Position.X,(float)Position.Y,speed);       //填装DrakBlueSprite的身体(纹理)数据
            enemybody.multiSprite.State = 0;                     //拨起0号动画
            enemybody.multiSprites[1].State = 0;                 //拨起身体的0号动画
            enemybody.multiSprites[1].changeinterval = 0.1f;
            enemybody.multiSprite.changeinterval = 0.1f;
            Direction = new Vector2D(0, -1);

            isleft = il;
            hp = 20000;       //20w血量
            renderlevel = 2;           //画在最顶层

            rotateTcset = new TCset(0.1f);
            fireTcset = new TCset(0.3f);
            TCsets = new List<TCset>();
            TCsets.Add(rotateTcset);
            TCsets.Add(fireTcset);
        }