コード例 #1
0
        void AddItem(ItemType_1 type)
        {
            //random item, random side, direction, random speed
            side = rand.Next(0, 4);


            switch (side)
            {
                //left, top, right, bottom
                case 0:
                    //direction = new Vector2(1,0);
                    direction = Vector2.Zero;
                    entryPosition = randomStartLocation(side);
                    break;
                case 1:
                    //direction = new Vector2(0,1);
                    direction = Vector2.Zero;
                    entryPosition = randomStartLocation(side);
                    break;
                case 2:
                    //direction = new Vector2(-1,0);
                    direction = Vector2.Zero;
                    entryPosition = randomStartLocation(side);
                    break;
                case 3:
                    //direction = new Vector2(0,-1);
                    direction = Vector2.Zero;
                    entryPosition = randomStartLocation(side);
                    break;
            }

            AddItem(type, entryPosition.X, entryPosition.Y, Config.EnemySpeed, direction);
        }
コード例 #2
0
        void AddItem(ItemType_1 type, float positionX, float positionY, float speed, Vector2 direction)
        {
            LevelItem_1 item;
            item.Time = timeCursor;
            item.Type = type;
            item.PositionX = positionX;
            item.PositionY = positionY;
            item.Speed = speed;
            item.Direction = direction;

            levelItems.Add(item);
        }
コード例 #3
0
 void AddItem(ItemType_1 type, float positionX, float positionY, float speed)
 {
     AddItem(type, positionX, positionY, speed, new Vector2(0, 1));
 }
コード例 #4
0
 void AddItem(ItemType_1 type, bool random)
 {
     if (random == true)
     {
         AddItem(type, Config.Rand.Next(5, 1551), Config.Rand.Next(5, 911), 0f, Vector2.Zero);
     }
     else
     {
         AddItem(type);
     }
 }