Exemple #1
0
    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);
    }
Exemple #2
0
 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);
         }
     }
 }
Exemple #3
0
	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();
    }
Exemple #4
0
    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);
            }
        }
    }
Exemple #5
0
    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;
    }