Exemple #1
0
 public void refresh()
 {
     Vector2D vct = new Vector2D(MainVector.X, MainVector.Y);
     vct.rotate(-count / 2 * angle);
     for (int i = 0; i < count; i++)
     {
         childvectors[i] = new Vector2D(vct.X, vct.Y);
         vct.rotate(angle);
     }
 }
Exemple #2
0
 public EqualAngleMultiVctor(Vector2D _mainvector, int _count, float _angle)
 {
     if (_count % 2 != 0)
         _count++;
     this.angle = _angle;
     this.count = _count;
     MainVector = _mainvector;        //设定主矢量
     childvectors = new Vector2D[count];
     Vector2D vct = new Vector2D(_mainvector.X, _mainvector.Y);
     vct.rotate(- count/2 *angle);
     for (int i = 0; i < count; i++)
     {
         childvectors[i] = new Vector2D(vct.X, vct.Y);
         vct.rotate(angle);
     }
 }
Exemple #3
0
        Vector2D direction = new Vector2D(); //运动方向

        public MissPoint(TextureManager texturemanager, double X, double Y, Vector2D dir, int score = 100)
        {
            //确定类型
            this.Type = Item.Miss_Point;
            working   = true;

            //确定弹射范围
            Position.X = X; Position.Y = Y;
            if (dir.Y < 0)
            {
                dir.Y = -dir.Y;
            }
            if (dir.X >= 0)
            {
                double rad = dir.GetAngle();
                if (rad > 60)
                {
                    rad = 60;
                }
                direction = new Vector2D(0, 1);
                direction.rotate((float)(Datas.LooselyRandom.NextDouble() * (rad - 2 * randDomain) + randDomain));
            }
            else
            {
                double rad = dir.GetAngle();
                rad = 360 - rad;
                if (rad > 60)
                {
                    rad = 60;
                }
                direction = new Vector2D(0, 1);
                direction.rotate(-((float)(Datas.LooselyRandom.NextDouble() * (rad - 2 * randDomain) + randDomain)));
            }

            speed_right = speed_totle * direction.X;
            speed_up    = speed_totle * direction.Y;

            double offset_x = Center_Distance * direction.X;
            double offset_y = Center_Distance * direction.Y;

            Position.X += offset_x;
            Position.Y += offset_y;

            offset_x    = Datas.LooselyRandom.NextDouble() * 2 * randFireDomain - randFireDomain;
            Position.X += offset_x;

            Texture texture = texturemanager.Get("Ef_etama2");

            sprite         = new Sprite();
            sprite.Texture = texture;
            sprite.SetHeight(16);
            sprite.SetWidth(16);
            sprite.SetUVs(14 * per_256, 8 * per_256, 16 * per_256, 10 * per_256);

            //保存了MissPoint的一些必要信息
            ItemData = new itemdata.MissPoint(score, 3);
        }
Exemple #4
0
        void playCommand()
        {
            foreach (TCset tcs in commands)
            {
                if (tcs.interval == time_caculate)
                {
                    tcs.useable = true;
                }
                if (tcs.useable)
                {
                    if (tcs.Name == "godir")
                    {
                        float dt      = (float)tcs.caculateTime - tcs.interval;
                        float percent = (dt - ((float)time_caculate - tcs.interval)) / dt;

                        enemydata.Speed = percent * percent * 200;
                    }
                    if (tcs.Name == "rotate")
                    {
                        float dt      = (float)tcs.caculateTime - tcs.interval;
                        float percent = ((float)time_caculate - tcs.interval) / dt * 0.5f + 0.5f;
                        enemydata.Speed = percent * percent * 200;
                        if (turnleft)
                        {
                            direction.rotate(-1);
                        }
                        else
                        {
                            direction.rotate(1);
                        }
                    }
                }
                if (tcs.caculateTime == time_caculate)
                {
                    tcs.useable = false;
                }
            }
        }
Exemple #5
0
        public MissPoint(TextureManager texturemanager, double X, double Y,Vector2D dir,int score = 100)
        {
            //确定类型
            this.Type = Item.Miss_Point;
            working = true;

            //确定弹射范围
            Position.X = X; Position.Y = Y;
            if (dir.Y < 0)
                dir.Y = -dir.Y;
            if (dir.X >= 0)
            {
                double rad = dir.GetAngle();
                if (rad > 60)
                    rad = 60;
                direction = new Vector2D(0, 1);
                direction.rotate((float)(Datas.LooselyRandom.NextDouble() * (rad - 2*randDomain) + randDomain));
            }
            else
            {
                double rad = dir.GetAngle();
                rad = 360 - rad;
                if (rad > 60)
                    rad = 60;
                direction = new Vector2D(0, 1);
                direction.rotate(-((float)(Datas.LooselyRandom.NextDouble() * (rad - 2 * randDomain) + randDomain)));
            }

            speed_right = speed_totle * direction.X;
            speed_up = speed_totle * direction.Y;

            double offset_x = Center_Distance * direction.X;
            double offset_y = Center_Distance * direction.Y;
            Position.X += offset_x;
            Position.Y += offset_y;

            offset_x = Datas.LooselyRandom.NextDouble() * 2 *randFireDomain - randFireDomain;
            Position.X += offset_x;

            Texture texture = texturemanager.Get("Ef_etama2");
            sprite = new Sprite();
            sprite.Texture = texture;
            sprite.SetHeight(16);
            sprite.SetWidth(16);
            sprite.SetUVs(14 * per_256, 8 * per_256, 16 * per_256, 10 * per_256);

            //保存了MissPoint的一些必要信息
            ItemData = new itemdata.MissPoint(score,3);
        }