Exemple #1
0
    //If I try to move to a tile, run the bump code on any object in the area and if none stop me move there
    public void Move(TileModel target)
    {
        if (target == null)
        {
            return;
        }
        if (target.GetContents() != null)
        {
            //if (Type == ThingTypes.Player) {
            //    Debug.Log(HasKey + "THIS MAN KEY PROTOCOL");
            //}

            EventMsg bumpMsg = new EventMsg(EventType.GetBumped, this);
            target.GetContents().TakeMsg(bumpMsg);

            //if (!target.GetContents().View.transform.Find("SpecialWall")) {
            //    EventMsg bumpMsg = new EventMsg(EventType.GetBumped, this);
            //    target.GetContents().TakeMsg(bumpMsg);
            //}
            //else {
            //    SetLocation(target);
            //}
        }
        else
        {
            SetLocation(target);
        }
    }
Exemple #2
0
    public void Move(int x, int y)
    {
        TileModel target = GetLocation().Neighbor(x, y);

        Move(target);
        if (target == null || (target.GetContents() != null && target.GetContents() != this))
        {
            God.C.AddAction(new BumpAction(this, Location.x + ((float)x) / 2f, Location.y + ((float)y) / 2f));
        }
    }
    //Move to a position relative to your current location
    public void Move(int x, int y)
    {
        //Neighbor() asks the tile what the tile is relative to them with an x any offset
        TileModel target = GetLocation().Neighbor(x, y);

        Move(target);
        if (target == null || (target.GetContents() != null && target.GetContents() != this))
        {
            God.C.AddAction(new BumpAction(this, Location.x + ((float)x) / 2f, Location.y + ((float)y) / 2f));
        }
    }
 //If I try to move to a tile, run the bump code on any object in the area and if none stop me move there
 public void Move(TileModel target)
 {
     if (target == null)
     {
         return;
     }
     if (target.GetContents() != null)
     {
         EventMsg bumpMsg = new EventMsg(EventType.GetBumped, this);
         target.GetContents().TakeMsg(bumpMsg);
     }
     else
     {
         SetLocation(target);
     }
 }
 //When you leave a tile remove yourself from its contents
 public void LeaveTile(TileModel tile)
 {
     if (tile.GetContents() == this)
     {
         tile.Contents = Guid.Empty;
     }
 }