コード例 #1
0
ファイル: Key.cs プロジェクト: BartoszF/ArtifactsRider
        public Key(Rectangle pos, Map map)
            : base(map)
        {
            Body BodyDec = new Body(map.PhysicalWorld);
            BodyDec.BodyType = BodyType.Static;

            PolygonShape S = new PolygonShape(1f);
            S.SetAsBox(pos.Width / 2, pos.Height / 2);

            Fixture = BodyDec.CreateFixture(S);
            Fixture.Restitution = 1f;
            Fixture.Friction = 10f;

            this.Position = pos;

            SetName("Key");

            LightingEngine LE = (LightingEngine)Renderer.GetRenderEffect("LightingEngine");

            light = new PointLight()
            {
                IsEnabled = true,
                Color = new Vector4(0.95f, .7f, .05f, 1f),
                Power = power,
                LightDecay = 350,
                Position = new Vector3(Position.X, Position.Y, 20),
                Direction = new Vector3(0,0, 0)
            };

            LE.AddLight(light);
        }
コード例 #2
0
ファイル: Zombie.cs プロジェクト: BartoszF/ArtifactsRider
        public Zombie(Rectangle pos, Map m)
            : base(m)
        {
            Body BodyDec = new Body(m.PhysicalWorld);
            BodyDec.BodyType = BodyType.Dynamic;

            Fixture = BodyDec.CreateFixture(new CircleShape(15f, 2.5f));
            //Fixture.Restitution = 0f;

            walkAnim = new Animation();
            walkNormalAnim = new AnimationNormal();

            walkAnim.Load("ZombieAnim", Vector2.One * 64, 6, 200);
            walkNormalAnim.Load("ZombieAnim_normal", Vector2.One * 64, 6, 200, (LightingEngine)Renderer.GetRenderEffect("LightingEngine"));

            walkAnim.Center = Vector2.One * 32;
            walkNormalAnim.Center = Vector2.One * 32;

            Position = pos;
            hp = 100;
            def = 1;
            damage = 2;
            lucky = 1;

            SetName("zombie");

            sounds = new Dictionary<string, ISound>();

            //sounds.Add("Sounds/Mobs/zombie_walk", GeneralManager.Sounds["Sounds/Mobs/zombie_walk"].CreateInstance());
            //sounds.Add("zombie_moan", GeneralManager.Sounds["Sounds/Mobs/zombie_moan"].CreateInstance());

            //pfinder = new PathFinderFast(m.GetChunk().GetCostArray());
        }
コード例 #3
0
        public WorldScreen(Game Game)
            : base(Game, GeneralManager.ScreenX, GeneralManager.ScreenY)
        {
            GeneralManager.LoadAnimation("TestAnim", Vector2.One * 64, 6, 80);
            GeneralManager.LoadAnimation("PlayerIdle", Vector2.One * 64, 1, 10000);

            DebugWindow.Visible = false;
            DebugWindow.AddGUI(FarseerDebugCheck, DebugWindow);
            AddGUI(DebugWindow);

            LE = new LightingEngine();
            Color a = new Color(ambient, ambient, ambient);
            LE.SetAmbient(a, a);
            //LE.SetAmbient(Color.Gray, Color.Gray);
            Renderer.AddRendererEffect(LE, "LightingEngine");

            LoadContent();

            Map = new Map(this, tileSize, mapSize);
            //Renderer.AddPostProcess(new BlurEffect(), "Blur");
            SE = new BlurSwitchEffect();
            SE.MaxTime = 1f;
            SE.TurnOffAction = delegate () {Renderer.RemovePostProcess("Switch");};
            Renderer.AddPostProcess(SE, "Switch");

            Camera.Init(GeneralManager.GetPartialRect(0, 0, 1, 1), new Rectangle(0, 0, tileSize * mapSize, tileSize * mapSize));

            PlayerLight = new SpotLight()
            {
                IsEnabled = true,
                Color = new Vector4(0.9f, .7f, .7f, 1f),
                Power = .6f,
                LightDecay = 600,
                Position = new Vector3(500, 400, 20),
                SpotAngle = 1.5f,
                SpotDecayExponent = 3,
                Direction = new Vector3(0.244402379f, 0.969673932f, 0)
            };
            LE.AddLight(PlayerLight);

            Debug = new FarseerPhysics.DebugViews.DebugViewXNA(Map.PhysicalWorld);
            Debug.AppendFlags(FarseerPhysics.DebugViewFlags.Shape);
            Debug.AppendFlags(FarseerPhysics.DebugViewFlags.AABB);
            Debug.AppendFlags(FarseerPhysics.DebugViewFlags.PerformanceGraph);
            Debug.AppendFlags(FarseerPhysics.DebugViewFlags.Joint);
            Debug.AppendFlags(FarseerPhysics.DebugViewFlags.ContactPoints);
            Debug.DefaultShapeColor = Color.White;
            Debug.SleepingShapeColor = Color.LightGray;
            Debug.LoadContent(Parent.GraphicsDevice, Parent.Content);

            //Weapon w = new Weapon("test", "Gun", 100, 10, Hands.One, 10, 600, 10, 10, 10);
            //Serializer.Serialize<Weapon>("weapon.xml", w);
        }
コード例 #4
0
ファイル: Chunk.cs プロジェクト: BartoszF/ArtifactsRider
        public int tileSize; /**< Size of single tile */

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="pos">Position in map</param>
        /// <param name="Parent">Reference to map instance</param>
        /// <param name="tileSize">Size of single tile</param>
        public Chunk(Rectangle pos, Map Parent, int tileSize)
        {
            this.position = pos;
            this.tileSize = tileSize;
            this.map = Parent;

            tiles = new Tile[pos.Width / tileSize, pos.Height / tileSize];

            GeneratorBase E = new DungeonGenerator();

            E.Generate(this);

            CheckIsolation();

            SaveImage("Content/Maps");
        }
コード例 #5
0
ファイル: Player.cs プロジェクト: BartoszF/ArtifactsRider
        public Player(Rectangle pos, Map m)
            : base(m)
        {
            Body BodyDec = new Body(m.PhysicalWorld);
            BodyDec.BodyType = BodyType.Dynamic;

            Fixture = BodyDec.CreateFixture(new CircleShape(15f, 1.0f));

            Body BodyDecSensor = new Body(m.PhysicalWorld);
            BodyDecSensor.BodyType = BodyType.Dynamic;

            PlayerSensor = BodyDecSensor.CreateFixture(new CircleShape(15f, .0f));
            PlayerSensor.Body.IsSensor = true;
            PlayerSensor.OnCollision += OnSensorCollide;

            this.Name = "player";
            this.texName = "Mobs/" + Name;
            this.normalName = "Mobs/" + Name + "_normal";

            this.Position = pos;
            hp = 100;
            def = 10;
            damage = 5;
            lucky = 123135;
            this.map = m;
            speed = 15500f;

            weapon = new AK47();

            IdleAnim = new Animation();
            IdleNormalAnim = new AnimationNormal();

            WalkAnim = new Animation();
            WalkNormalAnim = new AnimationNormal();

            IdleAnim = GeneralManager.Animations["PlayerIdle"];
            IdleAnim.Center = Vector2.One * 32;

            IdleNormalAnim.Load("PlayerIdle_normal", Vector2.One * 64, 1, 10000, (LightingEngine)Renderer.GetRenderEffect("LightingEngine"));
            IdleNormalAnim.Center = Vector2.One * 32;

            WalkAnim = GeneralManager.Animations["TestAnim"];
            WalkAnim.Center = Vector2.One * 32;

            WalkNormalAnim.Load("TestAnim_normal", Vector2.One * 64, 6, 80, (LightingEngine)Renderer.GetRenderEffect("LightingEngine"));
            WalkNormalAnim.Center = Vector2.One * 32;

            LightingEngine LE = (LightingEngine)Renderer.GetRenderEffect("LightingEngine");

            ShootLight = new SpotLight()
            {
                IsEnabled = true,
                Color = new Vector4(0.95f, .7f, .05f, 1f),
                Power = .6f,
                LightDecay = 600,
                Position = new Vector3(500, 400, 20),
                SpotAngle = 2f * 3.1415f,
                SpotDecayExponent = 3,
                Direction = new Vector3(0.244402379f, 0.969673932f, 0)
            };

            LE.AddLight(ShootLight);

            stoper = new Stopwatch();
            stoper.Start();
        }
コード例 #6
0
ファイル: Mob.cs プロジェクト: BartoszF/ArtifactsRider
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="Map">In which map, mob will be created</param>
 public Mob(Map Map)
     : base(Map)
 {
 }