public Role(bool hisId, string name) /* 用name来标识人物 */ { int emptyIndex = startLand.getAnEmptyIndex(); if (emptyIndex == -1) { Application.Quit(); } if (hisId) { role = Object.Instantiate(Resources.Load("Priest", typeof(GameObject)), startLand.getPos(emptyIndex), Quaternion.identity) as GameObject; startLand.setOccupied(emptyIndex); } else { role = Object.Instantiate(Resources.Load("Devil", typeof(GameObject)), startLand.getPos(emptyIndex), Quaternion.identity) as GameObject; startLand.setOccupied(emptyIndex); } role.name = name; isOnLand = 1; id = hisId; //move = role.AddComponent(typeof(Move)) as Move; click = role.AddComponent(typeof(Click)) as Click; //move.moveTowards(startLand.getPos(emptyIndex)); click.SetRole(this); }
public Vector3 goAshore() /* 人物上岸 */ { Land land = boat.getBoatPos() ? startLand : endLand; int pos = land.getAnEmptyIndex(); if (pos == -1) { Debug.Log("Land No Empty."); return(role.transform.position); } land.setOccupied(pos); boat.setEmpty(boat.getSeatByPos(role.transform.position)); //Debug.Log("Boat empty:" + boat.getSeatByPos(role.transform.position) + role.transform.position); //move.moveTowards(land.getPos(pos)); if (boat.getBoatPos()) { isOnLand = 1; } else { isOnLand = 2; } role.transform.parent = null; return(land.getPos(pos)); }