コード例 #1
0
ファイル: NormalVariant.cs プロジェクト: er1/c376balloon3d
        public void init(Game g, Vector2 v)
        {
            caller = g;
            windowSize = v;

            entities = new EntManager();
            entities.gameWidth = ((int)windowSize.X);
            entities.gameHeight = ((int)windowSize.Y);

            Epc = new EntPC();
            Epc.position = Vector3.Zero;
            Epc.resistance = 0.8f;
            Epc.font = EntPC.defaultFont;
            entities.add(Epc);

            int numsets = 5;
            for (int i = 0; i < numsets; ++i)
            {
                Vector3 p = new Vector3((float)Math.Cos(Math.PI * 2 * i / numsets), (float)Math.Sin(Math.PI * 2 * i / numsets), (float)(Ent.rand.NextDouble() * 2.0 - 1.0));
                EntBalloonSet e = new EntBalloonSet(p * 8);
                e.velocity = p * 0.1f;
                entities.add(e);
            }

            startballoons = 0;
            foreach (Ent e in entities.Ents)
            {
                if (e is EntBalloon) startballoons++;
            }
        }
コード例 #2
0
ファイル: NormalVariant.cs プロジェクト: er1/c376balloon2d
        public void init(Game g, Vector2 v)
        {
            caller = g;
            windowSize = v;

            entities = new EntManager();
            entities.gameWidth = ((int)windowSize.X);
            entities.gameHeight = ((int)windowSize.Y);

            Epc = new EntPC();
            Epc.position = windowSize / 2;
            Epc.resistance = 0.8f;
            Epc.font = EntPC.defaultFont;
            entities.add(Epc);

            int numsets = 7;
            for (int i = 0; i < numsets; ++i)
            {
                Vector2 p = new Vector2((float)Math.Cos(Math.PI * 2 * i / numsets), (float)Math.Sin(Math.PI * 2 * i / numsets));
                EntBalloonSet e = new EntBalloonSet(p * 256 + windowSize / 2);
                e.velocity = new Vector2(p.Y, -p.X) * 4;
                entities.add(e);
            }

            startballoons = 0;
            foreach (Ent e in entities.Ents)
            {
                if (e is EntBalloon) startballoons++;
            }

            clouds = new List<Vector2>();

            for (int i = 0; i < 20; ++i) {
                clouds.Add(new Vector2((float)Ent.rand.NextDouble(), (float)Ent.rand.NextDouble()) * (windowSize - new Vector2(cloud.Width, cloud.Height)));
            }
        }