Пример #1
0
		protected override void OnLoadContent()
		{
			// Test paralax
			para = new Parallax();
			ratioX = 0;

			AddChild(para);

			CCS = new CurrentChampionState(1000,100);

			//AddChild(new GameUI(CCS),10);

			ESCMenu menu = new ESCMenu();
			AddChild(menu, 5);
			menu.SetPositionInScreenPercent(50, 50);

			champSprite = new DrawableChampionSprite(ChampionAnimation.idle, ChampionTypes.ManMega, ChampionsInfo) 
			{ Position = new Vector2(200f, 300f) };

			AddChild(champSprite);

			AS = new ActionSequence(ActionSequence.INFINITE_SEQUENCE,
			                        new ActionMoveBy(new TimeSpan(0,0,1), new Vector2(100, 100)), 
			                        new ActionMoveBy(new TimeSpan(0,0,1), new Vector2(-100, -100)));

			champSprite.PerformAction(AS);

			DrawableTriangle tr =  new DrawableTriangle(true);
			tr.Ascendant = false;
			tr.Tint = Color.Blue;
			tr.Scale = new Vector2(1f,2f);


			//Test particle
			/*ParticleSystem sys = new ParticleSystem(Content, 1000, null);
			sys.Position = new Vector2(100, 100);
			AddChild(sys);*/

			//AddChild(new PingCounter(() => Client.Instance.GetPing().TotalMilliseconds));
			//inputManager.RegisterEvent(InputActions.Spell1, new EventHandler(Jump));

			inputManager.RegisterEvent(InputActions.Spell3, new EventHandler(Jump));
			inputManager.RegisterEvent(InputActions.GoRight, (sender, e)=> {
				ratioX+=2;
				para.SetCurrentRatio(ratioX,0f);
			});
			inputManager.RegisterEvent(InputActions.GoLeft, (sender, e)=> {
				ratioX-=2;
				para.SetCurrentRatio(ratioX,0f);
			});

			//inputManager.RegisterEvent(InputActions.Jump, new EventHandler(Jump2));

			DrawableCircle circle = new DrawableCircle();
			circle.SetPositionRelativeToObject(champSprite, new Vector2(-150, -30));
			AddChild(circle);

			//AddChild(new DeathScreen(10),11);
		}
Пример #2
0
        public DrawableChampion(ChampionT champion, bool ally, ChampionsInfo championsInfo)
        {
            Champion       = champion;
            ChampionSprite = new DrawableChampionSprite(ChampionAnimation.idle, champion.Type, championsInfo);
            ChampionSprite.PlayAnimation(ChampionAnimation.run);
            ChampionSprite.RelativeOrigin = new Vector2(0.5f, 1f);
            ChampionSprite.Position       = new Vector2(Champion.CollisionWidth / 2f, Champion.CollisionHeight);

            LifeBar = new DrawableChampionLifeBar(ally)
            {
                Position  = new Vector2(Champion.CollisionWidth / 2f, -Champion.CollisionHeight / 2f),
                MaxHealth = champion.MaxHealth,
                Health    = champion.Health
            };
        }