コード例 #1
0
ファイル: PortalCell.cs プロジェクト: jdeter14/game1
 internal PortalCell(GridPortal parentPortal, IPortalAction action)
 {
     _parentPortal = parentPortal;
     _action = action;
 }
コード例 #2
0
ファイル: PortalCell.cs プロジェクト: andrewstarnes/wwtd2
 internal PortalCell(GridPortal parentPortal, bool oneWay, IPortalAction action)
 {
     _parentPortal = parentPortal;
     _isOneWay     = oneWay;
     _action       = action;
 }
コード例 #3
0
ファイル: GridPortal.cs プロジェクト: forwolk/UnityApex
        /// <summary>
        /// Creates a GridPortal instance.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="type">The type of the portal.</param>
        /// <param name="direction">The direction of the portal.</param>
        /// <param name="portalOne">The bounds of the first portal.</param>
        /// <param name="portalTwo">The bounds of the second portal.</param>
        /// <param name="exclusiveTo">The attribute mask to indicate if this portal is exclusive to (only available to) certain units.</param>
        /// <param name="action">The action that handles moving between portals.</param>
        /// <returns>The portal instance</returns>
        public static GridPortal Create(string name, PortalType type, PortalDirection direction, Bounds portalOne, Bounds portalTwo, AttributeMask exclusiveTo, IPortalAction action)
        {
            var p = new GridPortal();
            p.Initialize(name, type, direction, portalOne, portalTwo, exclusiveTo, action);

            return p;
        }
コード例 #4
0
ファイル: GridPortal.cs プロジェクト: forwolk/UnityApex
        private void Initialize(string name, PortalType type, PortalDirection direction, Bounds portalOne, Bounds portalTwo, AttributeMask exclusiveTo, IPortalAction action)
        {
            _type = type;
            _direction = direction;
            _exclusiveTo = exclusiveTo;
            _portalOneBounds = portalOne;
            _portalTwoBounds = portalTwo;

            _cellOne = new PortalCell(this, false, action);
            _cellTwo = new PortalCell(this, _direction == PortalDirection.Oneway, action);

            _gridOne = _cellOne.Initialize(_cellTwo, portalOne);
            _gridTwo = _cellTwo.Initialize(_cellOne, portalTwo);

            if (_gridOne == null || _gridTwo == null)
            {
                throw new ArgumentException("A grid portal has been placed with one or more of its portals outside a grid. Portals must be on a grid.");
            }

            _name = GridManager.instance.RegisterPortal(name, this);
        }
コード例 #5
0
ファイル: GridPortal.cs プロジェクト: forwolk/UnityApex
 /// <summary>
 /// Creates a GridPortal instance.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="type">The type of the portal.</param>
 /// <param name="portalOne">The bounds of the first portal.</param>
 /// <param name="portalTwo">The bounds of the second portal.</param>
 /// <param name="exclusiveTo">The attribute mask to indicate if this portal is exclusive to (only available to) certain units.</param>
 /// <param name="action">The action that handles moving between portals.</param>
 /// <returns>The portal instance</returns>
 public static GridPortal Create(string name, PortalType type, Bounds portalOne, Bounds portalTwo, AttributeMask exclusiveTo, IPortalAction action)
 {
     return Create(name, type, PortalDirection.Twoway, portalOne, portalTwo, exclusiveTo, action);
 }
コード例 #6
0
        private void Initialize(string name, PortalType type, PortalDirection direction, Bounds portalOne, Bounds portalTwo, AttributeMask exclusiveTo, IPortalAction action)
        {
            _type            = type;
            _direction       = direction;
            _exclusiveTo     = exclusiveTo;
            _portalOneBounds = portalOne;
            _portalTwoBounds = portalTwo;

            _cellOne = new PortalCell(this, false, action);
            _cellTwo = new PortalCell(this, _direction == PortalDirection.Oneway, action);

            _gridOne = _cellOne.Initialize(_cellTwo, portalOne);
            _gridTwo = _cellTwo.Initialize(_cellOne, portalTwo);

            if (_gridOne == null || _gridTwo == null)
            {
                throw new ArgumentException("A grid portal has been placed with one or more of its portals outside a grid. Portals must be on a grid.");
            }

            _name = GridManager.instance.RegisterPortal(name, this);
        }
コード例 #7
0
        /// <summary>
        /// Creates a GridPortal instance.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="type">The type of the portal.</param>
        /// <param name="direction">The direction of the portal.</param>
        /// <param name="portalOne">The bounds of the first portal.</param>
        /// <param name="portalTwo">The bounds of the second portal.</param>
        /// <param name="exclusiveTo">The attribute mask to indicate if this portal is exclusive to (only available to) certain units.</param>
        /// <param name="action">The action that handles moving between portals.</param>
        /// <returns>The portal instance</returns>
        public static GridPortal Create(string name, PortalType type, PortalDirection direction, Bounds portalOne, Bounds portalTwo, AttributeMask exclusiveTo, IPortalAction action)
        {
            var p = new GridPortal();

            p.Initialize(name, type, direction, portalOne, portalTwo, exclusiveTo, action);

            return(p);
        }
コード例 #8
0
 /// <summary>
 /// Creates a GridPortal instance.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="type">The type of the portal.</param>
 /// <param name="portalOne">The bounds of the first portal.</param>
 /// <param name="portalTwo">The bounds of the second portal.</param>
 /// <param name="exclusiveTo">The attribute mask to indicate if this portal is exclusive to (only available to) certain units.</param>
 /// <param name="action">The action that handles moving between portals.</param>
 /// <returns>The portal instance</returns>
 public static GridPortal Create(string name, PortalType type, Bounds portalOne, Bounds portalTwo, AttributeMask exclusiveTo, IPortalAction action)
 {
     return(Create(name, type, PortalDirection.Twoway, portalOne, portalTwo, exclusiveTo, action));
 }
コード例 #9
0
 internal PortalCell(GridPortal parentPortal, bool oneWay, IPortalAction action)
 {
     _parentPortal = parentPortal;
     _isOneWay = oneWay;
     _action = action;
 }