Пример #1
0
        public StaticObject(ICanyonShooterGame game, StaticObjectDescription desc)
            : base(game, desc.Name)
        {
            this.game = game;
            StaticDescription sd = game.Content.Load <StaticDescription>("Content/Statics/" + desc.Name);

            SetModel(sd.Model);

            //TODO: Implement Position relative to canyon from XML Config (additive)
            DataLayer.Level.LevelCache c = game.World.Level.Cache[desc.SegmentId];
            ContactGroup = Engine.Physics.ContactGroup.Statics;

            CanyonSegment = desc.SegmentId;
            // Get the position from current canyon segment
            LocalPosition = game.World.Level.Cache[desc.SegmentId].APos + sd.Position;
            Vector3 canyonDir = game.World.Level.Cache[desc.SegmentId].ADir;

            canyonDir.Normalize();

            // Rotate the player to zero
            LocalRotation = Quaternion.Identity;
            LocalRotation = Helper.RotateTo(canyonDir, new Vector3(0, 0, -100));
            //Velocity = Vector3.Zero;
            if (game.Graphics.ShadowMappingSupported)
            {
                game.World.Sky.Sunlight.ShadowMapLow.Scene.AddDrawable(this);
                game.World.Sky.Sunlight.ShadowMapHigh.Scene.AddDrawable(this);
            }
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WaypointObject"/> class.
        /// </summary>
        /// <param name="game">The game.</param>
        /// <param name="desc">The desc.</param>
        public WaypointObject(ICanyonShooterGame game, WaypointObjectDescription desc)
            : base(game, "Waypoint")
        {
            this.game      = game;
            ConnectedToXpa = true;
            Static         = true;
            SetModel(desc.Model);

            //game.GameStates.Profil.
            secondsToAdd  = desc.TimeInSeconds;
            CanyonSegment = desc.SegmentId;
            DataLayer.Level.LevelCache c = game.World.Level.Cache[desc.SegmentId];
            //Vector3 canyonPosition = new Vector3(c.APosX, c.APosY, c.APosZ);
            //Quaternion rotation = Helper.RotateTo(game.World.Level.Cache[desc.SegmentId].ADir, -Vector3.UnitZ);
            //LocalPosition = Vector3.Transform(desc.RelativeSpawnLocation, rotation) + canyonPosition;
            ContactGroup = Engine.Physics.ContactGroup.Waypoint;
            // Get the position from current canyon segment
            LocalPosition = game.World.Level.Cache[desc.SegmentId].APos;
            Vector3 canyonDir = game.World.Level.Cache[desc.SegmentId].ADir;

            canyonDir.Normalize();

            // Rotate the player to zero
            LocalRotation = Quaternion.Identity;
            LocalRotation = Helper.RotateTo(canyonDir, new Vector3(0, 0, -100));
            //Velocity = Vector3.Zero;



            if (game.Graphics.ShadowMappingSupported)
            {
                game.World.Sky.Sunlight.ShadowMapLow.Scene.AddDrawable(this);
                game.World.Sky.Sunlight.ShadowMapHigh.Scene.AddDrawable(this);
            }
        }