本文整理汇总了C#中WorldObject类的典型用法代码示例。如果您正苦于以下问题:C# WorldObject类的具体用法?C# WorldObject怎么用?C# WorldObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorldObject类属于命名空间,在下文中一共展示了WorldObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addMovement
public virtual void addMovement(WorldObject worldObject)
{
////Debug.Log("addMovementWO");
additionalTargetRange = ResourceManager.GetRadius(worldObject.WObjectName);
target = worldObject;
addMovement(worldObject._transform.position);
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例6: AddObject
public void AddObject(WorldObject obj, string prefab)
{
if (!_entities.ContainsKey(obj.InstanceId))
{
_entities.Add(obj.InstanceId, obj);
}
}
示例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(); }
}
}
示例8: CollectFoodFromPastureTask
public CollectFoodFromPastureTask(PastureSim pasture, WorldObject foodItem)
{
pasture.Building.TasksAssociatedWithBuilding.Add(this);
Pasture = pasture;
FoodItem = foodItem;
TaskType = TaskType.CollectFoodFromPasture;
}
示例9: MoveCraftedResourceToDepotTask
public MoveCraftedResourceToDepotTask(Building craftBuilding, WorldObject obj)
{
DwarfConsole.WriteLine("Move crafted", ConsoleColor.Red);
CraftBuilding = craftBuilding;
Obj = obj;
TaskType = Tasks.TaskType.MoveCraftedResource;
}
示例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);
//}
}
示例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);
}
示例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);
}
示例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);
}
示例14: ItemInfoIdentArgs
public ItemInfoIdentArgs(WorldObject identifiedItem, bool dontShowIfItemHasNoRule = false, bool dontShowIfIsSalvageRule = false)
{
IdentifiedItem = identifiedItem;
DontShowIfItemHasNoRule = dontShowIfItemHasNoRule;
DontShowIfIsSalvageRule = dontShowIfIsSalvageRule;
}
示例15: EBoundingBox
public EBoundingBox(EBoundingBox copy, WorldObject holder)
: base(copy, holder)
{
Type = copy.Type;
Events = new List<ObjectEvent>(copy.Events);
EventsToRemove = new Queue<ObjectEvent>();
}