Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Client.Common.Views.UnitView"/> class.
        /// </summary>
        /// <param name="model">The model.</param>
        public UnitView(Core.Models.Entity model)
            : base(model)
        {
            var defView = (UnitDefinitionView)model.Definition.View;
            if (defView != null)
            {
                var diplomacy = model.GetDiplomacy(GameAppDelegate.Account);
                var sprite = defView.GetSpriteCopy(diplomacy);
                // Node.Position = Helper.PositionHelper.GamePositionIToWorldPoint(model.Position);
                sprite.Scale = 1.35f;
                sprite.AnchorPoint = new CCPoint(0.0f, 0.8f);
                Node = sprite;
                Node.Position = Helper.PositionHelper.CellToTile(model.Position.CellPosition);
                DrawRegion = model.Position.RegionPosition;
                m_healthbar = new Effects.Healthbar();
                Node.AddChild(m_healthbar);

                RefreshHealth();
                Animate(UnitAnimation.Idle);
            }
        }
Exemple #2
0
 /// <summary>
 /// Adds the healthbar.
 /// </summary>
 public void AddHealthbar(/*Core.Models.Entity entity, CCTileMapCoordinates coord*/)
 {
     m_healthbar = new Healthbar();
     m_healthbar.AnchorPoint = CCPoint.AnchorLowerLeft;
     AddChild(m_healthbar);
 }