GetPosition() public method

Returns position and direction for placement.
public GetPosition ( Placement placement, int border = -1 ) : int[]
placement Placement
border int
return int[]
示例#1
0
        /// <summary>
        /// Adds prop to puzzle in place.
        /// </summary>
        /// <param name="place"></param>
        /// <param name="prop"></param>
        /// <param name="positionType"></param>
        public void AddProp(PuzzlePlace place, DungeonProp prop, Placement positionType)
        {
            if (this.Region == null)
            {
                throw new PuzzleException("AddProp outside of OnPuzzleCreate.");
            }

            var pos = place.GetPosition(positionType);

            prop.RegionId = this.Region.Id;
            prop.Info.X   = pos[0];
            prop.Info.Y   = pos[1];
            prop.UpdateShapes();
            prop.Info.Direction = MabiMath.DegreeToRadian(pos[2]);
            prop.Behavior      += PuzzleEvent;

            this.Region.AddProp(prop);
            this.Props[prop.Name] = prop;
        }
示例#2
0
文件: Puzzle.cs 项目: hzdlive/aura-1
		/// <summary>
		/// Adds prop to puzzle in place.
		/// </summary>
		/// <param name="place"></param>
		/// <param name="prop"></param>
		/// <param name="positionType"></param>
		public void AddProp(PuzzlePlace place, DungeonProp prop, Placement positionType)
		{
			if (this.Region == null)
				throw new PuzzleException("AddProp outside of OnPuzzleCreate.");

			var pos = place.GetPosition(positionType);

			prop.RegionId = this.Region.Id;
			prop.Info.X = pos[0];
			prop.Info.Y = pos[1];
			prop.UpdateShapes();
			prop.Info.Direction = MabiMath.DegreeToRadian(pos[2]);
			prop.Behavior += PuzzleEvent;

			this.Region.AddProp(prop);
			this.Props[prop.Name] = prop;
		}