本文整理汇总了C#中Person.SetBusy方法的典型用法代码示例。如果您正苦于以下问题:C# Person.SetBusy方法的具体用法?C# Person.SetBusy怎么用?C# Person.SetBusy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person.SetBusy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: actionTick
public override ActionResult actionTick (Person person)
{
if (Map.CurrentMap.getObject(person.currentMapPos) is Building)
{
Building CurrentBuilding = (Building)Map.CurrentMap.getObject(person.currentMapPos);
//check for another person
var other = CurrentBuilding.GetNonBusyPersonInBuilding();
if (CurrentBuilding.teamID == person.teamID && other != null && other.teamID == person.teamID)
{
person.SetBusy(20);
CurrentBuilding.GetNonBusyPersonInBuilding().SetBusy(20);
if (CurrentBuilding.m_buildingtype == BuildingType.turfHut)
{
Map.CurrentMap.AddPerson(person.currentMapPos, person.teamID);
return ActionResult.SUCCESS;
}
else if( CurrentBuilding.m_buildingtype == BuildingType.House)
{
Map.CurrentMap.AddPerson(person.currentMapPos, person.teamID);
Map.CurrentMap.AddPerson(person.currentMapPos, person.teamID);
return ActionResult.SUCCESS;
}
}
}
return ActionResult.FAIL;
}
示例2: actionTick
public override ActionResult actionTick (Person person)
{
if (Map.CurrentMap.getObject(person.currentMapPos) is Building)
{
Building CurrentBuilding = (Building)Map.CurrentMap.getObject(person.currentMapPos);
if (CurrentBuilding.m_buildingtype == BuildingType.Storage
&& CurrentBuilding.teamID == person.teamID)
{
person.SetBusy(1);
foreach (var item in person.Resources)
{
//UnityEngine.Debug.Log(item.Key + ": " + item.Value);
Map.CurrentMap.GetTeamData(person.teamID).Resources[item.Key] += item.Value;
}
person.ResetResources();
return ActionResult.SUCCESS;
}
}
Building nearestStorage = Map.CurrentMap.GetTeamData(person.teamID).GetNearestBuilding (person.currentMapPos, BuildingType.Storage);
if (nearestStorage == null) {
return ActionResult.FAIL;
}
person.ToDoList.Insert (0, new Move (person.currentMapPos, nearestStorage.m_MapPos));
return ActionResult.CONTINUE;
}
示例3: actionTick
public override ActionResult actionTick (Person person)
{
if (destination == null) {
ResourceTile tile = Map.CurrentMap.GetNearestResourceTile (person.currentMapPos, type);
Building nearestMine = Map.CurrentMap.GetNearestBuilding (person.currentMapPos, BuildingType.Mine);
float distanceToTile = (tile.m_MapPos - person.currentMapPos).magnitude ();
float distanceToBuilding = nearestMine != null ? (nearestMine.m_MapPos - person.currentMapPos).magnitude () : float.MaxValue;
if (distanceToTile > distanceToBuilding) {
destination = nearestMine.m_MapPos;
} else {
destination = tile.m_MapPos;
}
}
if (person.currentMapPos == destination) {
MapObject mo = Map.CurrentMap.getObject(destination);
if (mo is Building) {
Building b = mo as Building;
if (b.m_buildingtype == BuildingType.Mine && person.Skills.Contains(Skill.Miner))
{
person.Resources[type] += 1;
person.ToDoList[0] = new Store();
return ActionResult.CONTINUE;
} else {
return ActionResult.FAIL;
}
}
if (mo is ResourceTile) {
ResourceTile rt = mo as ResourceTile;
if (rt.m_resource == type) {
person.Resources[rt.m_resource] += rt.GatherResource(type);
person.SetBusy(5);
person.ToDoList[0] = new Store();
return ActionResult.CONTINUE;
} else {
return ActionResult.FAIL;
}
}
}
person.ToDoList.Insert (0, new Move (person.currentMapPos, destination));
return ActionResult.CONTINUE;
}
示例4: actionTick
public override ActionResult actionTick (Person person)
{
var CurrentTeamData = Map.CurrentMap.GetTeamData (person.teamID);
if (Map.CurrentMap.getObject(person.currentMapPos) is Building)
{
Building CurrentBuilding = (Building)Map.CurrentMap.getObject(person.currentMapPos);
if (CurrentBuilding.m_buildingtype == BuildingType.Sawmill
&& CurrentBuilding.teamID == person.teamID
&& person.Skills.Contains(Skill.Labourer)
&& CurrentTeamData.Resources[ResourceType.Timber] > 0)
{
person.SetBusy(10);
CurrentTeamData.Resources[ResourceType.Timber]--;
person.Resources[ResourceType.Wood]++;
}
}
return ActionResult.FAIL;
}
示例5: actionTick
public override ActionResult actionTick (Person person)
{
if (!person.Skills.Contains (Skill.Lumberjack)) {
return ActionResult.FAIL;
}
if (Map.CurrentMap.getObject(person.currentMapPos) is ResourceTile)
{
ResourceTile tile = (ResourceTile)Map.CurrentMap.getObject(person.currentMapPos);
if(tile.m_resource == ResourceType.Timber
&& person.Skills.Contains(Skill.Lumberjack))
{
person.Resources[ResourceType.Timber] += tile.GatherResource(ResourceType.Timber);
person.SetBusy(5);
person.ToDoList[0] = new Store();
return ActionResult.CONTINUE; //Don't want to remove it.
}
}
ResourceTile nearestResource = Map.CurrentMap.GetNearestResourceTile (person.currentMapPos, ResourceType.Timber);
person.ToDoList.Insert (0, new Move (person.currentMapPos, nearestResource.m_MapPos));
return ActionResult.CONTINUE;
}
示例6: actionTick
public override ActionResult actionTick (Person person)
{
if (person.Skills.Contains(Skill.Rifleman))
{
List<Person> others = new List<Person>();
for(IVec2 offset = new IVec2(-5,-5); offset.x < 6;++offset.x)
{
for(offset.y = -5; offset.y < 6;++offset.y)
{
if(offset.magnitude() <= 5)
{
others.AddRange(Map.CurrentMap.GetPeopleAt(person.currentMapPos + offset));
}
}
}
Person other = null;
foreach (var item in others)
{
if(item.teamID != person.teamID)
{
other = item;
break;
}
}
if(other)
{
if(other.Skills.Contains(Skill.Rifleman) && UnityEngine.Random.Range(0,100) < (100.0f/3f * 2f))
{
Map.CurrentMap.KillPerson(person);
}
else
{
Map.CurrentMap.KillPerson(other);
person.SetBusy(1);
}
}
}
return ActionResult.FAIL;
}
示例7: actionTick
public override ActionResult actionTick (Person person)
{
if (target == null)
{
foreach (Person p in Map.CurrentMap.GetTeamData(person.teamID).GetPeople())
{
if (p == person) continue;
target = p;
}
}
if (!taskDispatched) {
mutualLearningZone = (person.currentMapPos + target.currentMapPos) / 2;
var nearestSchool = Map.CurrentMap.GetTeamData(person.teamID).GetNearestBuilding(mutualLearningZone, BuildingType.School);
if (nearestSchool == null)
{
inSchool = StayInSchool.no;
}
if (inSchool == StayInSchool.yes)
{
mutualLearningZone = nearestSchool.m_MapPos;
}
if (inSchool == StayInSchool.whocares)
{
if ((mutualLearningZone - person.currentMapPos).magnitude() > (nearestSchool.m_MapPos - person.currentMapPos).magnitude())
{
mutualLearningZone = nearestSchool.m_MapPos;
inSchool = StayInSchool.yes;
}
else
{
inSchool = StayInSchool.no;
}
}
target.ToDoList.Insert (0, new Learn (mutualLearningZone));
taskDispatched = true;
}
if (skill == Skill.Rifleman) {
if (Map.CurrentMap.getObject (person.currentMapPos) is Building) {
Building CurrentBuilding = (Building)Map.CurrentMap.getObject (person.currentMapPos);
var other = CurrentBuilding.GetNonBusyPersonInBuilding ();
if (person.Skills.Contains (Skill.Rifleman)
&& CurrentBuilding.m_buildingtype == BuildingType.Barracks
&& CurrentBuilding.teamID == person.teamID
&& other != null
&& other.teamID == person.teamID) {
person.SetBusy (RIFLE_TRAIN_TIME);
other.SetBusy (RIFLE_TRAIN_TIME);
other.Skills.Add (Skill.Rifleman);
return ActionResult.SUCCESS;
}
}
}
if (inSchool == StayInSchool.yes) {
if (Map.CurrentMap.getObject(person.currentMapPos) is Building)
{
Building CurrentBuilding = (Building)Map.CurrentMap.getObject(person.currentMapPos);
if (CurrentBuilding.m_buildingtype == BuildingType.School
&& CurrentBuilding.teamID == person.teamID)
{
var other = CurrentBuilding.GetNonBusyPersonInBuilding();
while (other != null && other.teamID == person.teamID)
{
foreach (var item in person.Skills)
{
if (!other.Skills.Contains(item))
{
other.SetBusy(50);
person.SetBusy(50);
other.Skills.Add(item);
return ActionResult.SUCCESS;
}
}
other = CurrentBuilding.GetNonBusyPersonInBuilding();
}
}
}
} else {
if (target == null || target.teamID != person.teamID)
return ActionResult.FAIL;
if (target.currentMapPos == person.currentMapPos) {
if(!target.Skills.Contains(skill))
{
target.SetBusy(TRAIN_TIME);
person.SetBusy(TRAIN_TIME);
target.transform.Translate(1.5f, 0, 0);
person.transform.Translate(-1.5f, 0, 0);
target.Skills.Add(skill);
return ActionResult.SUCCESS;
//.........这里部分代码省略.........