Exemplo n.º 1
0
        public PlayerBar(CSKEntity player)
        {
            Portrait = player.Portrait;
            Portrait.AnchorPoint = new CCPoint(0, 0);
            AddChild(Portrait);

            LifeBar = new CCProgressTimer("bar/green_health_bar.png");
            LifeBar.Color = CCColor3B.Blue;
            LifeBar.PositionX = Portrait.BoundingBox.Size.Width + 10;
            LifeBar.Type = CCProgressTimerType.Bar;

            LifeBar.AnchorPoint = new CCPoint(0, 0);
            AddChild(LifeBar);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets a random position in the level from a actor
        /// </summary>
        /// <param name="actor"></param>
        /// <returns></returns>
        public CCPoint GetRandomPosition(CSKEntity actor)
        {
            int minX = (int)(wSize.Width + actor.centerToSides);
            int maxX = (int)(GetMapTotalWidth() - actor.centerToSides);
            int minY = (int)actor.centerToBottom; // ContentSize.Height;
            int maxY = (int)(actor.Texture.ContentSizeInPixels.Inverted.Height);

            return CCPointExHelper.GetRandomPosition(wSize, minX, maxX, minY, maxY);
        }
Exemplo n.º 3
0
 public bool DistanceSQ(CSKEntity entity, float distance)
 {
     return DistanceSQ(entity) <= distance;
 }
Exemplo n.º 4
0
 public float DistanceSQ(CSKEntity entity)
 {
     CCPoint pos = entity.Position;
     return Position.DistanceSquared(ref pos);
 }