Beispiel #1
0
        public override void join()
        {
            for (int i = 0; i < 32; ++i)
            {
                double r = rand.NextDouble() * Math.PI * 2;
                Color c = new Color((float)Math.Cos(r) * 0.5f + 0.5f, (float)Math.Cos(r + Math.PI * 2.0 / 3) * 0.5f + 0.5f, (float)Math.Cos(r - Math.PI * 2.0 / 3) * 0.5f + 0.5f);

                EntBalloon Eballoon = new EntBalloon();
                manager.add(Eballoon);
                balloons.Add(Eballoon);
                Eballoon.set = this;

                double th = rand.NextDouble() * Math.PI * 2;
                double d = rand.NextDouble() * 48 + 16;

                Eballoon.position = new Vector2((float)(Math.Cos(th) * d), (float)(Math.Sin(th) * d));
                Eballoon.velocity = Vector2.Zero;
            }
            size = 100;
        }
Beispiel #2
0
        public override void think()
        {
            velocity += new Vector2((float)Math.Cos(Math.Sin(wanderangle) / 2), (float)Math.Sin(Math.Sin(wanderangle) / 2));
            wanderangle += 0.1;
            base.think();

            if (rand.NextDouble() < 0.01)
            {
                Vector2 d = new Vector2((float)rand.NextDouble(), (float)rand.NextDouble());
                if (target != null)
                    d = target.position - position;
                d.Normalize();

                EntBalloon b = new EntBalloon();
                b.position = position + (d * (size / 2));
                b.velocity = d * 4;

                manager.queueAdd(b);
            }
        }
Beispiel #3
0
        public override void think()
        {
            velocity += new Vector3(1.0f + (float)Math.Cos(Math.Sin(wanderangle) / 2), (float)Math.Sin(Math.Sin(wanderangle) / 2), 0) / 100;
            wanderangle += 0.1;
            base.think();

            if (rand.NextDouble() < 0.01)
            {
                Vector3 d = new Vector3((float)rand.NextDouble(), (float)rand.NextDouble(), (float)rand.NextDouble());
                if (target != null)
                    d = target.position - position;
                d.Normalize();

                EntBalloon b = new EntBalloon(true);
                b.position = position + d * size;
                b.velocity = d * 0.2f;

                manager.queueAdd(b);
            }
        }