Пример #1
0
 public static void Load(Device device)
 {
     Resource.device            = device;
     textures["reimu"]          = Texture.FromFile(device, "reimu.png");
     textures["enemy1"]         = Texture.FromFile(device, "enemy1.png");
     textures["bullet1"]        = Texture.FromFile(device, "bullet1.png");
     rectangle["reimu_bullet1"] = new Rectangle(new TexRect(0, 0.570313f, 0.054688f, 0.617188f), textures["reimu"], 7, 6, 90);
     rectangle["bullet_1_1"]    = new Rectangle(new TexRect(0, 0, 0.0625f, 0.0625f), textures["bullet1"], 5, 5, 90);
     rectangle["bullet_1_2"]    = new Rectangle(new TexRect(0, 0, 0.0625f, 0.0625f), textures["bullet1"], 5, 5, 90);
     rectangle["bullet_1_3"]    = new Rectangle(new TexRect(0, 0, 0.0625f, 0.0625f), textures["bullet1"], 5, 5, 90);
     rectangle["bullet_1_4"]    = new Rectangle(new TexRect(0, 0, 0.0625f, 0.0625f), textures["bullet1"], 5, 5, 90);
     path["path0"] = new WayPointPath(WayPointPath.Smooth2(new Vector3[] {
         new Vector3(-40, 50, 0),
         new Vector3(-40, -50, 0),
         new Vector3(40, 50, 0),
         new Vector3(40, -50, 0)
     }, 5));
 }
Пример #2
0
        public WayPointPath(WayPointPath p1, WayPointPath p2)
        {
            WayPoints = new WayPoint[p1.WayPoints.Length + p2.WayPoints.Length];
            int   i  = 0;
            int   j  = 0;
            float D1 = p1.WayPoints[p1.WayPoints.Length - 1].Milestone;
            float D2 = (p2.WayPoints[0].Position - p1.WayPoints[p1.WayPoints.Length - 1].Position).Length();
            float D  = D1 + D2;

            for (; i < p1.WayPoints.Length; i++)
            {
                WayPoints[i]           = new WayPoint();
                WayPoints[i].Position  = p1.WayPoints[i].Position;
                WayPoints[i].Milestone = p1.WayPoints[i].Milestone;
            }
            for (; i < WayPoints.Length; i++, j++)
            {
                WayPoints[i]           = new WayPoint();
                WayPoints[i].Position  = p1.WayPoints[j].Position;
                WayPoints[i].Milestone = p1.WayPoints[j].Milestone + D;
            }
        }