本文整理汇总了C#中WorldObject类的典型用法代码示例。如果您正苦于以下问题:C# WorldObject类的具体用法?C# WorldObject怎么用?C# WorldObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorldObject类属于命名空间,在下文中一共展示了WorldObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: addMovement
public virtual void addMovement(WorldObject worldObject)
{
////Debug.Log("addMovementWO");
additionalTargetRange = ResourceManager.GetRadius(worldObject.WObjectName);
target = worldObject;
addMovement(worldObject._transform.position);
}
开发者ID:sentonnes,项目名称:RTS-Framework,代码行数:7,代码来源:Unit.cs
示例2: Update
public static void Update(UpdateValuesDto dto, WorldObject obj)
{
switch(obj.TypeId) {
case ObjectTypeId.Item:
UpdateItem(dto, (Item)obj);
break;
case ObjectTypeId.Container:
UpdateContainer(dto, (Container)obj);
break;
case ObjectTypeId.Unit:
UpdateUnit(dto, (Unit)obj);
break;
case ObjectTypeId.Player:
UpdatePlayer(dto, (Player)obj);
break;
case ObjectTypeId.GameObject:
UpdateGameObject(dto, (GameObject)obj);
break;
case ObjectTypeId.DynamicObject:
UpdateDynamicObject(dto, (DynamicObject)obj);
break;
case ObjectTypeId.Corpse:
UpdateCorpse(dto, (Corpse)obj);
break;
case ObjectTypeId.Object:
case ObjectTypeId.AIGroup:
case ObjectTypeId.AreaTrigger:
UpdateObject(dto, obj);
break;
default:
throw new ArgumentOutOfRangeException();
}
}
开发者ID:hazzik,项目名称:uwow2,代码行数:33,代码来源:UpdateObjectDtoMapper.cs
示例3: CanFit
public Boolean CanFit(WorldObject wObj, Vector2f position)
{
foreach (BBoundingBox BB in wObj.BBoundingBoxes)
{
IntRect rect = BB.GetNextTRect(position);
for (int y = rect.Top; y < rect.Bottom + 1; ++y)
{
for (int x = rect.Left; x < rect.Right + 1; ++x)
{
if (GetBlock(x, y))
{
return false;
}
IEnumerator<BBoundingBox> mapBBsEnum = GetBBoundingBoxesEnumerator(x, y, 0);
while (mapBBsEnum.MoveNext())
{
if (BB.Holder == mapBBsEnum.Current.Holder)
continue;
if (!BB.BoundingBoxTest(mapBBsEnum.Current, position))
continue;
return false;
}
}
}
}
return true;
}
开发者ID:eickegao,项目名称:Blazera,代码行数:32,代码来源:Ground.cs
示例4: Create
public static MyWorldObject Create(WorldObject wo)
{
MyWorldObject mwo = new MyWorldObject();
Dictionary<int, bool> boolValues = new Dictionary<int,bool>();
Dictionary<int, double> doubleValues = new Dictionary<int,double>();
Dictionary<int, int> intValues = new Dictionary<int, int>();
Dictionary<int, string> stringValues = new Dictionary<int,string>();
List<int> activeSpells = new List<int>();
List<int> spells = new List<int>();
foreach (var key in wo.BoolKeys)
boolValues.Add(key, wo.Values((BoolValueKey)key));
foreach (var key in wo.DoubleKeys)
doubleValues.Add(key, wo.Values((DoubleValueKey)key));
foreach (var key in wo.LongKeys)
intValues.Add(key, wo.Values((LongValueKey)key));
foreach (var key in wo.StringKeys)
stringValues.Add(key, wo.Values((StringValueKey)key));
for (int i = 0 ; i < wo.ActiveSpellCount ; i++)
activeSpells.Add(wo.ActiveSpell(i));
for (int i = 0; i < wo.SpellCount; i++)
spells.Add(wo.Spell(i));
mwo.Init(wo.HasIdData, wo.Id, wo.LastIdTime, (int)wo.ObjectClass, boolValues, doubleValues, intValues, stringValues, activeSpells, spells);
return mwo;
}
开发者ID:IbespwnAC,项目名称:MagTools,代码行数:33,代码来源:MyWorldObjectCreator.cs
示例5: DoesBuildingHaveNecessaryMaterialsForCrafting
private bool DoesBuildingHaveNecessaryMaterialsForCrafting(Building b, WorldObject obj)
{
bool does = true;
bool haveRequested = TaskManager.IsAlreadyGettingNecessaryBuildingMaterials(b, obj);
int counter = 0;
if (obj.ElementType == MapElementType.Meal)
{
foreach (KeyValuePair<MapElementType, List<WorldObject>> keyValue in b.DepositedWorldObjects)
{
foreach (WorldObject depobj in keyValue.Value)
{
if (depobj.GetType().IsSubclassOf(typeof(Food)))
{
return true;
}
}
}
return false;
}
else
{
foreach (KeyValuePair<MapElementType, int> materials in obj.NeededForCrafting)
{
if (b.DepositedWorldObjects.ContainsKey(materials.Key) == false)
{
for (int i = 0; i < materials.Value; i++)
{
if (haveRequested == false)
{
TaskManager.AddTask(new GetBuildingMaterialTask(materials.Key, obj.Level, b));
counter++;
}
does = false;
}
}
else
{
for (int i = 0; i < materials.Value - b.GetNumberOfDepositedMaterial(materials.Key, obj.Level); i++)
{
if (haveRequested == false)
{
TaskManager.AddTask(new GetBuildingMaterialTask(materials.Key, obj.Level, b));
counter++;
}
does = false;
}
}
}
}
if (counter == 1)
{
}
return does;
}
开发者ID:steffan88,项目名称:Bevelle,代码行数:60,代码来源:DoesBuildingHaveEnoughResourcesForCrafting.cs
示例6: AddObject
public void AddObject(WorldObject obj, string prefab)
{
if (!_entities.ContainsKey(obj.InstanceId))
{
_entities.Add(obj.InstanceId, obj);
}
}
开发者ID:alvyxaz,项目名称:dagger-online,代码行数:7,代码来源:EntityManager.cs
示例7: ResolveCollision
public static void ResolveCollision(WorldObject objectTriggering, WorldObject objectHit)
{
if (objectTriggering is PlayerShip)
{
if (objectHit is Asteroid)
{
objectTriggering.DestroySelf();
objectHit.DefaultDestructAction(); ;
}
if (objectHit is Ring)
{
objectHit.DestroySelf();
}
}
if (objectTriggering is Laser)
{
if (objectHit is Asteroid) { objectHit.DestroySelf(); objectTriggering.DestroySelf(); }
}
if (objectTriggering is Bomb)
{
if (objectHit is Asteroid) { objectHit.DestroySelf(); }
}
}
开发者ID:Nhadden,项目名称:XNA-Procedural-Game-Project,代码行数:25,代码来源:CollisionResolver.cs
示例8: CollectFoodFromPastureTask
public CollectFoodFromPastureTask(PastureSim pasture, WorldObject foodItem)
{
pasture.Building.TasksAssociatedWithBuilding.Add(this);
Pasture = pasture;
FoodItem = foodItem;
TaskType = TaskType.CollectFoodFromPasture;
}
开发者ID:steffan88,项目名称:Bevelle,代码行数:7,代码来源:CollectFoodFromPastureTask.cs
示例9: MoveCraftedResourceToDepotTask
public MoveCraftedResourceToDepotTask(Building craftBuilding, WorldObject obj)
{
DwarfConsole.WriteLine("Move crafted", ConsoleColor.Red);
CraftBuilding = craftBuilding;
Obj = obj;
TaskType = Tasks.TaskType.MoveCraftedResource;
}
开发者ID:steffan88,项目名称:Bevelle,代码行数:7,代码来源:MoveCraftedResourceToDepotTask.cs
示例10: AddObject
public void AddObject(WorldObject obj)
{
this.allObjects.Add(obj);
IControllable objAsControllable = obj as IControllable;
if (objAsControllable != null)
{
this.controllables.Add(objAsControllable);
}
IResource objAsResource = obj as IResource;
if (objAsResource != null)
{
this.resources.Add(objAsResource);
}
//IGatherer objAsGatherer = obj as IGatherer;
//if (objAsGatherer != null)
//{
// this.gatherers.Add(objAsGatherer);
//}
//IFighter objAsFighter = obj as IFighter;
//if (objAsFighter != null)
//{
// this.fighters.Add(objAsFighter);
//}
}
开发者ID:prestress,项目名称:Telerik_Academy_Homework_Projects,代码行数:28,代码来源:Program.cs
示例11: ChangeSelection
/*** Private worker methods ***/
private void ChangeSelection(WorldObject worldObject, Player controller)
{
//this should be called by the following line, but there is an outside chance it will not
SetSelection(false);
if(controller.SelectedObject) controller.SelectedObject.SetSelection(false);
controller.SelectedObject = worldObject;
worldObject.SetSelection(true);
}
开发者ID:jn5414,项目名称:unity-rts-demo,代码行数:9,代码来源:WorldObject.cs
示例12: AttackCommand
public AttackCommand(Unit unit, WorldObject target)
{
this.target = target;
this.unit = unit;
targetRotation = Quaternion.LookRotation (target.transform.position - unit.transform.position);
targetOneCommand = new TargetOneCommand (unit, target);
unit.IssueSubCommand (targetOneCommand);
}
开发者ID:Strathcona,项目名称:SpaceGame,代码行数:8,代码来源:AttackCommand.cs
示例13: LoadContent
public void LoadContent()
{
mPlayerTexture = Game.Content.Load<Texture2D>("blue");
mPlayerBulletTexture = Game.Content.Load<Texture2D>("spark");
mPlayer = new WorldObject(mPlayerTexture);
//mPlayer.Position = new Vector2(0, 0);
mWorld.SetPlayerComponent(mPlayer);
}
开发者ID:julietrubin,项目名称:Shooter_Game,代码行数:8,代码来源:Player.cs
示例14: ItemInfoIdentArgs
public ItemInfoIdentArgs(WorldObject identifiedItem, bool dontShowIfItemHasNoRule = false, bool dontShowIfIsSalvageRule = false)
{
IdentifiedItem = identifiedItem;
DontShowIfItemHasNoRule = dontShowIfItemHasNoRule;
DontShowIfIsSalvageRule = dontShowIfIsSalvageRule;
}
开发者ID:IbespwnAC,项目名称:MagTools,代码行数:8,代码来源:ItemInfoIdentArgs.cs
示例15: EBoundingBox
public EBoundingBox(EBoundingBox copy, WorldObject holder)
: base(copy, holder)
{
Type = copy.Type;
Events = new List<ObjectEvent>(copy.Events);
EventsToRemove = new Queue<ObjectEvent>();
}
开发者ID:eickegao,项目名称:Blazera,代码行数:8,代码来源:EBoundingBox.cs
示例16: SaveWorldObject
public static void SaveWorldObject(JsonWriter writer, WorldObject worldObject)
{
if (writer == null || worldObject == null) return;
writer.WriteStartObject();
worldObject.SaveDetails(writer);
writer.WriteEndObject();
}
开发者ID:acenode,项目名称:unity-rts-demo,代码行数:8,代码来源:SaveManager.cs
示例17: AddToBucket
/// <summary>
/// Add this CollisionObject to bucket.
/// </summary>
internal override void AddToBucket(WorldObject worldObject)
{
int bottomLeftX = (int)(worldObject.Pos.X + TL.X) / (int)Collision.CellWidth;
int bottomLeftY = (int)(worldObject.Pos.Y + BR.Y) / (int)Collision.CellHeight;
int topRightX = (int)(worldObject.Pos.X + BR.X) / (int)Collision.CellWidth;
int topRightY = (int)(worldObject.Pos.Y + TL.Y) / (int)Collision.CellHeight;
AddToBucket(worldObject, bottomLeftX, bottomLeftY, topRightX, topRightY);
}
开发者ID:nemec,项目名称:4Realms,代码行数:12,代码来源:Collision_AABB.cs
示例18: addToBucket
/// <summary>
/// Add this CollisionObject to bucket.
/// </summary>
internal override void addToBucket(WorldObject worldObject)
{
int bottomLeftX = (int)(worldObject.Pos.X + centerPointOffset.X - radius) / (int)Collision.gridCellWidth;
int bottomLeftY = (int)(worldObject.Pos.Y + centerPointOffset.Y - radius) / (int)Collision.gridCellHeight;
int topRightX = (int)(worldObject.Pos.X + centerPointOffset.X + radius) / (int)Collision.gridCellWidth;
int topRightY = (int)(worldObject.Pos.Y + centerPointOffset.Y + radius) / (int)Collision.gridCellHeight;
AddToBucket(worldObject, bottomLeftX, bottomLeftY, topRightX, topRightY);
}
开发者ID:vincentgarcia00,项目名称:frostbyte-entertainment,代码行数:12,代码来源:Collision_BoundingCircle.cs
示例19: DepositWorldObject
public override void DepositWorldObject(WorldObject worldObject)
{
if (worldObject.ElementType == MapElementType.Beer)
{
}
//PrintDepositedWorldObjects();
base.DepositWorldObject(worldObject);
}
开发者ID:steffan88,项目名称:Bevelle,代码行数:9,代码来源:Depot.cs
示例20: SetBuilding
public override void SetBuilding(Building project, WorldObject worldObject)
{
base.SetBuilding (project, worldObject);
currentProject = project;
target = worldObject;
addMovement(worldObject);
amountBuilt = 0.0f;
building = true;
}
开发者ID:sentonnes,项目名称:RTS-Framework,代码行数:9,代码来源:Worker.cs
注:本文中的WorldObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论