public bool AllowIncomingMove(ITilePlaceable incomingPlaceable, int dirX, int dirY) { if (mProperties.canBeWalkedOver) { return true; } if (!incomingPlaceable.GetProperties().canPushBlocks) { return false; } ITile siblingTile = mOwningTile.GetSiblingTile(dirX, dirY); if(siblingTile == null) { return false; } return siblingTile.AllowIncomingMove(this, dirX, dirY); }
public void RemoveFromUpdateList(ITilePlaceable placeable) { if (placeable.GetProperties().inUpdateSequenceFor > 0) { ArrayList removeUpdates = new ArrayList(); foreach (PlaceableUpdate rUpdate in mPlaceableUpdates) { if (rUpdate.placeable == placeable) { removeUpdates.Add(rUpdate); } } foreach (PlaceableUpdate rUpdate in removeUpdates) { mPlaceableUpdates.Remove(rUpdate); } } }
public void TryIncomingMove(ITilePlaceable interferingObj, int dirX, int dirY) { ArrayList moveList = new ArrayList(); foreach (ITilePlaceable obj in mPlaceables) { if(obj.GetProperties().canBeWalkedOver) { obj.TryIncomingMove(interferingObj, dirX, dirY); } else { moveList.Add(obj); } } if(moveList.Count > 0) { foreach (ITilePlaceable obj in moveList) { obj.TryIncomingMove(interferingObj, dirX, dirY); } if(interferingObj.GetProperties().isPlayer) { return; } } TriggerSpecialMoveConditions(interferingObj); interferingObj.PostMove(); }
public void TriggerSpecialMoveConditions(ITilePlaceable interferingObj) { if (mType == TerrainType.kBlockHole && !interferingObj.GetProperties().isPlayer) { mParentNavGrid.RemoveFromUpdateList(interferingObj); interferingObj.PrepForRemoval(); mParentNavGrid.Delete(interferingObj.GetConnectedObject()); interferingObj.Clear(); } else { interferingObj.SetAsOwningTile(this); LockToPosition(interferingObj); if (mPushDirX != 0 || mPushDirY != 0) { int forcedPushAmount = Math.Max(interferingObj.GetProperties().sticksInUpdateFor, 1); mParentNavGrid.AddToUpdateList(interferingObj, mPushDirX, mPushDirY, forcedPushAmount); } } }
public bool AllowIncomingMove(ITilePlaceable interferingObj, int dirX, int dirY) { if (!mPlayerPassable && interferingObj.GetProperties().isPlayer) { return false; } if(!mBlockPassable && !interferingObj.GetProperties().isPlayer) { return false; } foreach (ITilePlaceable obj in mPlaceables) { if (!obj.AllowIncomingMove(interferingObj, dirX, dirY)) { return false; } } return true; }