1234567891011121314151617181920212223242526272829303132333435 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using Sfs2X.Entities.Data;
- public class MoveMessage : Message
- {
- public MoveMessage(int id, int col, int row)
- {
- this.cmd = Command.Move;
- this.data = new SFSObject();
- data.PutInt("i", id);
- data.PutInt("x", col);
- data.PutInt("y", row);
- }
- public override bool AttempOverride (Message msg)
- {
- MoveMessage moveMsg = msg as MoveMessage;
- if(moveMsg == null)
- return false;
- int originId = data.GetInt("i");
- int targetId = msg.data.GetInt("i");
- if(originId == targetId)
- {
- this.data = msg.data;
- return true;
- }
- return false;
- }
- }
|