Esempio n. 1
0
        public override void updateTime(float timeSinceLastFrameUpdate)
        {
            base.updateTime(timeSinceLastFrameUpdate);
            BunkerTile bunkerTile = (BunkerTile)levelTile;
            float      yaw        = 0;
            float      pitch      = bunkerTile.Angle;

            if (bunkerTile is FlakBunkerTile)
            {
                FlakBunkerTile fbt = (bunkerTile as FlakBunkerTile);
                yaw = fbt.YAngle;
                if (fbt.Direction == Direction.Left) // jesli dzialko jest w polowie obrotu
                {
                    pitch = Math.PI - pitch;
                }
            }

            rotateGun(pitch, yaw);

            if (bunkerTile.UsingReflector)
            {
                rotateReflector(bunkerTile.ReflectorAngle);

                if (bunkerTile.IsIlluminatedShot)
                {
                    foreach (SceneNode n in reflectorSubNodes)
                    {
                        n.SetScale(54.0f, 1.0f, 14.0f);
                    }
                }
                else
                {
                    foreach (SceneNode n in reflectorSubNodes)
                    {
                        n.SetScale(24.0f, 1.0f, 10.0f);
                    }
                }

                if ((bunkerTile.IsDestroyed && reflectorNode != null) && flickeringReflectorWhenDestroyed)
                {
                    if (Math.RangeRandom(0.0f, 1.0f) > 0.9f)
                    {
                        reflectorNode.SetVisible(false);
                    }
                    if (Math.RangeRandom(0.0f, 1.0f) > 0.9f)
                    {
                        reflectorNode.SetVisible(true);
                    }
                }
            }
        }
Esempio n. 2
0
        protected static PointD GetInitialVector(IObject2D owner, IObject2D target, float initialSpeed)
        {
            float speedCoeff    = 2 * target.MovementVector.EuclidesLength / GameConsts.P47Plane.Singleton.MaxSpeed;
            float distanceCoeff = FlakBunkerTile.GetAccuracyCoefficient((target.Bounds.Center - owner.Center).EuclidesLength);

            float xSpread = distanceCoeff * speedCoeff * target.Bounds.Width * GameConsts.FlakBunker.FireSpreadX;
            float ySpread = distanceCoeff * speedCoeff * target.Bounds.Height * GameConsts.FlakBunker.FireSpreadY;

            float  xPos         = mRand.Next((int)(target.Bounds.Center.X - xSpread * 0.5f), (int)(target.Bounds.Center.X + xSpread * 0.5f));
            float  yPos         = mRand.Next((int)(target.Bounds.Center.Y * 1.2f - ySpread * 0.5f), (int)(target.Bounds.Center.Y * 1.2f + ySpread * 0.5f));
            PointD flakPosition = new PointD(xPos, yPos);

            PointD direction = (flakPosition - owner.Center);

            direction.Normalise();

            return(initialSpeed * direction);
        }
Esempio n. 3
0
 public void OnFlakFire(FlakBunkerTile bunker, Plane plane, Wof.Model.Level.Common.PointD pos, bool hit)
 {
 }