예제 #1
0
파일: Follow.cs 프로젝트: pdovy/OpenRA
        public override IActivity Tick( Actor self )
        {
            if (IsCanceled) return NextActivity;
            if (!Target.IsValid) return NextActivity;

            var inRange = ( Util.CellContaining( Target.CenterLocation ) - self.Location ).LengthSquared < Range * Range;

            if( inRange ) return this;

            var ret = new Move( Target, Range );
            ret.Queue( this );
            return ret;
        }
예제 #2
0
파일: Move.cs 프로젝트: comradpara/OpenRA
 protected override MovePart OnComplete( Actor self, Mobile mobile, Move parent )
 {
     self.CenterLocation = Util.CenterOfCell( mobile.toCell );
     mobile.fromCell = mobile.toCell;
     return null;
 }
예제 #3
0
파일: Move.cs 프로젝트: comradpara/OpenRA
 protected abstract MovePart OnComplete( Actor self, Mobile mobile, Move parent );
예제 #4
0
파일: Move.cs 프로젝트: comradpara/OpenRA
 public void TickMove( Actor self, Mobile mobile, Move parent )
 {
     moveFraction += (int)Util.GetEffectiveSpeed(self);
     if( moveFraction >= moveFractionTotal )
         moveFraction = moveFractionTotal;
     UpdateCenterLocation( self, mobile );
     if( moveFraction >= moveFractionTotal )
     {
         parent.move = OnComplete( self, mobile, parent );
         if( parent.move == null )
             UpdateCenterLocation( self, mobile );
     }
 }
예제 #5
0
파일: Move.cs 프로젝트: comradpara/OpenRA
            protected override MovePart OnComplete( Actor self, Mobile mobile, Move parent )
            {
                var unit = self.traits.Get<Unit>();

                var nextCell = parent.PopPath( self, mobile );
                if( nextCell != null )
                {
                    if( ( nextCell - mobile.toCell ) != ( mobile.toCell - mobile.fromCell ) )
                    {
                        var ret = new MoveFirstHalf(
                            Util.BetweenCells( mobile.fromCell, mobile.toCell ),
                            Util.BetweenCells( mobile.toCell, nextCell.Value ),
                            unit.Facing,
                            Util.GetNearestFacing( unit.Facing, Util.GetFacing( nextCell.Value - mobile.toCell, unit.Facing ) ),
                            moveFraction - moveFractionTotal );
                        mobile.fromCell = mobile.toCell;
                        mobile.toCell = nextCell.Value;
                        return ret;
                    }
                    else
                        parent.path.Add( nextCell.Value );
                }
                var ret2 = new MoveSecondHalf(
                    Util.BetweenCells( mobile.fromCell, mobile.toCell ),
                    Util.CenterOfCell( mobile.toCell ),
                    unit.Facing,
                    unit.Facing,
                    moveFraction - moveFractionTotal );
                mobile.fromCell = mobile.toCell;
                return ret2;
            }
예제 #6
0
파일: Move.cs 프로젝트: mgatland/OpenRA
 public void TickMove( Actor self, Mobile mobile, Move parent )
 {
     moveFraction += (int)mobile.MovementSpeedForCell(self, mobile.toCell);
     if( moveFraction >= moveFractionTotal )
         moveFraction = moveFractionTotal;
     UpdateCenterLocation( self, mobile );
     if( moveFraction >= moveFractionTotal )
     {
         parent.move = OnComplete( self, mobile, parent );
         if( parent.move == null )
             UpdateCenterLocation( self, mobile );
     }
 }