Ejemplo n.º 1
0
        public OrkForest(Vector2 position, Map map, Vector2 patrolTarget, NewTimer timer)
        {
            this.map = map;
            this.timer = timer;

            Tag = "OrkForest";

            transform = AddComponent<Transform>();
            transform.Position = position;

            renderer = AddComponent<ViewRenderer>();
            //renderer.SetImage(Managers.Content.Load<Texture2D>("Sprites/OrkForest/OrkForest_Front_0"));
            renderer.SetImage(Managers.Content.Load<Texture2D>("Sprites/Sprite_Sheet/RougyMon"), 32, 32);
            renderer.Pivot = new Vector2(renderer.ImageWidth / 2, renderer.ImageHeight / 1f);

            patrol = AddComponent<Patrol>();
            patrol.PatrolToTarget(patrolTarget);
            moveSpeed = 1;

            collider = AddComponent<BoxCollider>();
            collider.OnCollisionEnter += OnCollisionEnter;

            Animation = new SpriteAnimation(
               string.Empty,
            Managers.Content.Load<Texture2D>("Sprites/Sprite_Sheet/RougyMon"),
               Path.Combine(Managers.Content.RootDirectory, "Sprites", "Sprite_Sheet", "RougyMon.xml"));
            Animation.FrameDelay = 100;

            EventManager.OnLateUpdate += OnLateUpdate;
            EventManager.OnUpdate += OnUpdate;
        }
Ejemplo n.º 2
0
        public Player(Vector2 position, Map map, DoorForest doorForest, GateGraveyard gateGraveyard)
        {
            this.gateGraveyard = gateGraveyard;
            this.doorForest = doorForest;
            this.map = map;

            Tag = "Player";

            transform = AddComponent<Transform>();
            transform.Position = position;

            renderer = AddComponent<ViewRenderer>();
            renderer.SetImage(Managers.Content.Load<Texture2D>("Sprites/Sprite_Sheet/RougyMon"), 32, 32);
            //renderer.Pivot = new Vector2(renderer.ImageWidth / 2, renderer.ImageHeight / 1f);
            renderer.Pivot = new Vector2(16, 32);

            moveWithInput = AddComponent<MoveWithInput>();
            moveWithInput.Speed = 5;
            moveWithInput.MoveWithArrow = OptionsMenuScreen.MoveArrows;

            collider = AddComponent<BoxCollider>();
            collider.OnCollisionEnter += OnCollisionEnter;

            Animation = new SpriteAnimation(
                string.Empty,
                Managers.Content.Load<Texture2D>("Sprites/Sprite_Sheet/RougyMon"),
                Path.Combine(Managers.Content.RootDirectory, "Sprites", "Sprite_Sheet", "RougyMon.xml"));
            Animation.FrameDelay = 100;

            EventManager.OnUpdate += OnUpdate;
            EventManager.OnLateUpdate += OnLateUpdate;
        }