本文整理汇总了C#中BaseObject类的典型用法代码示例。如果您正苦于以下问题:C# BaseObject类的具体用法?C# BaseObject怎么用?C# BaseObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseObject类属于命名空间,在下文中一共展示了BaseObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ObjectAccessItem
public ObjectAccessItem(int userID, BaseObject obj)
: this()
{
this.CreatorID = userID;
this.Users = new List<UserAccess>();
this.Object = new LinkBaseObject(obj);
}
示例2: TileWithObject
public TileWithObject(Tile t, BaseObject baseObject, bool resize = false)
: base(t.TexturePath, t.Rectangle)
{
if (baseObject == null)
return;
Put(baseObject, resize);
}
示例3: OnTriggerExit
void OnTriggerExit( Collider other )
{
BaseObject bo = other.GetComponentInChildren<BaseObject>();
if ( bo && bo == sensedObject )
sensedObject = null;
}
示例4: CheckCollision
public bool CheckCollision(Rectangle rectangle, out Animation outAnimation, out BaseObject outBaseObject, string id)
{
outAnimation = null;
outBaseObject = null;
foreach (var baseObject in _entities)
{
if(baseObject == null)
continue;
if(baseObject.Id == id)
continue;
var sprite = baseObject.GetComponent<Sprite>(ComponentType.Sprite);
if(sprite == null)
continue;
if (sprite.Rectangle.Intersects(rectangle))
{
outAnimation = baseObject.GetComponent<Animation>(ComponentType.Animation);
outBaseObject = baseObject;
return true;
}
}
return false;
}
示例5: moveTo
public void moveTo(BaseObject target)
{
if (_currentState == PlayerState.DEFAULT)
{
if (_activeTarget != null && target.pointInGraph == _activeTarget.pointInGraph)
{
_activeTarget.onAction();
}
else
{
_activeTarget = target;
setState(PlayerState.MOVING);
_navigator.startRoute(_activeTarget);
}
}
else
{
if (_targetsStack.Count > 0)
{
BaseObject item = (BaseObject)_targetsStack[0];
if(item.pointInGraph == target.pointInGraph)
return;
}
else if (_activeTarget.pointInGraph == target.pointInGraph)
{
return;
}
_targetsStack.Add(target);
}
}
示例6: Level
public Level(ContentManager content, BaseObject player)
{
_entities = new List<LevelEntity>();
_content = content;
_player = player;
ManagerInput.FireNewInput += ManagerInput_FireNewInput;
}
示例7: hit
void hit(BaseObject.objectType t)
{
if (tx > 1)
tx = 0;
tx += 1f / 2;
moveBoss();
}
示例8: CheckCollision
public bool CheckCollision(Rectangle rectangle, out Animation outAnimation, out BaseObject outBaseObject, string id, bool checkOnlyHostile=false)
{
outAnimation = null;
outBaseObject = null;
foreach (var baseObject in _entities)
{
if(baseObject == null)
continue;
if(baseObject.Id != null && baseObject.Id == id)
continue;
var sprite = baseObject.GetComponent<Sprite>();
if(sprite == null)
continue;
if (sprite.Rectangle.Intersects(rectangle))
{
if(checkOnlyHostile)
if (!baseObject.Hostile)
continue;
outAnimation = baseObject.GetComponent<Animation>();
outBaseObject = baseObject;
return true;
}
}
return false;
}
示例9: LoadContent
public override void LoadContent(ContentManager content)
{
_managerMap.LoadContent();
var player = new BaseObject {Id = "player"};
player.AddComponent(new Sprite(content.Load<Texture2D>("link_full"), 16, 16, new Vector2(50, 50)));
player.AddComponent(new PlayerInput(ManagerScreen,_managerPlayer));
player.AddComponent(new Animation(16, 16,2));
player.AddComponent(new Collision(_managerMap,_entities));
player.AddComponent(new Camera(_managerCamera));
player.AddComponent(new Equipment(content,_managerMap,_managerCamera,_entities));
player.GetComponent<Equipment>(ComponentType.Equipment).AddItem(new Boomerang());
player.GetComponent<Equipment>(ComponentType.Equipment).AddItem(new Sword(_entities));
player.GetComponent<Equipment>(ComponentType.Equipment).EquipItemInSlot(1,ItemSlot.A);
player.GetComponent<Equipment>(ComponentType.Equipment).EquipItemInSlot(2, ItemSlot.B);
player.AddComponent(new Damage(_entities,true));
player.AddComponent(FactoryStats.GetStats("Link"));
player.AddComponent(new GUI());
player.GetComponent<GUI>(ComponentType.GUI).LoadContent(content);
//var testNPC = new BaseObject();
//testNPC.AddComponent(new Sprite(content.Load<Texture2D>("Marin"), 16, 16, new Vector2(50, 50)));
//testNPC.AddComponent(new AIMovementRandom(200));
//testNPC.AddComponent(new Animation(16, 16));
//testNPC.AddComponent(new Collision(_managerMap));
//testNPC.AddComponent(new Camera(_managerCamera));
_entities.AddEntity(player);
//for (int n = 0; n < 3; n++)
//{
// var testEnemy = new BaseObject {Id = string.Format("enemy_{0}", n)};
// testEnemy.AddComponent(new Sprite(content.Load<Texture2D>("Octorok"), 16, 16, new Vector2(50 + ManagerFunction.Random(10,20), 50 + ManagerFunction.Random(10,20))));
// testEnemy.AddComponent(new AIMovementRandom(1000, 0.5f));
// testEnemy.AddComponent(new Animation(16, 16, 2));
// testEnemy.AddComponent(new Collision(_managerMap));
// testEnemy.AddComponent(new Octorok(player, content.Load<Texture2D>("Octorok_bullet"), _managerMap));
// testEnemy.AddComponent(new Camera(_managerCamera));
// testEnemy.AddComponent(new Damage(_entities));
// testEnemy.AddComponent(FactoryStats.GetStats("Octorok"));
// _entities.AddEntity(testEnemy);
//}
//_entities.AddEntity(testNPC);
//Script test!
//var testEnemy = new BaseObject { Id = string.Format("enemy_{0}", "script") };
//testEnemy.AddComponent(new Sprite(content.Load<Texture2D>("Octorok"), 16, 16, new Vector2(50 + ManagerFunction.Random(10, 20), 50 + ManagerFunction.Random(10, 20))));
//testEnemy.AddComponent(new AIMovementRandom(1000, 0.5f));
//testEnemy.AddComponent(new Animation(16, 16, 2));
//testEnemy.AddComponent(new Collision(_managerMap,_entities));
//testEnemy.AddComponent(new Octorok(player, content.Load<Texture2D>("Octorok_bullet"), _managerMap,_entities));
//testEnemy.AddComponent(new Camera(_managerCamera));
//testEnemy.AddComponent(new Damage(_entities));
//testEnemy.AddComponent(FactoryStats.GetStats("Octorok"));
//testEnemy.AddComponent(new Script("script_time_test"));
//_entities.AddEntity(testEnemy);
//Just for test
//var window = new WindowMessage("Hello, this is a message! This is a long message",content);
//ManagerWindow.NewWindow("test_message",window);
}
示例10: CreateObject
private void CreateObject(Enemy enemy)
{
var baseObject = new BaseObject { Username = enemy.UniqueId.ToString()};
baseObject.AddComponent(new Sprite(_texture, 32, 32, new Vector2(enemy.Position.ScreenXPosition, enemy.Position.ScreenYPosition), Color.Black, enemy.Position.Visible));
baseObject.AddComponent(new Animation(16, 16, 2));
//Later we add specific component for enemies here.
_enemies.Add(baseObject);
}
示例11: OctorokBullet
public OctorokBullet(Sprite sprite, Collision collision, BaseObject player, Direction direction)
{
_sprite = sprite;
_player = player;
_direction = direction;
_speed = 1.5f;
_collision = collision;
}
示例12: CreateObject
public void CreateObject()
{
//Arrange
var obj = new BaseObject();
//Assert
Assert.IsTrue(obj.Id != Guid.Empty);
}
示例13: Build
public static SmsTextingException Build(BaseObject details)
{
String message = "";
if (details != null && details.Errors != null)
{
message = details.Errors.Aggregate((current, next) => current + "; " + next);
}
return new SmsTextingException(message, details);
}
示例14: Octorok
public Octorok(BaseObject player,Texture2D bulletTexture, ManagerMap map, int cooldown = 1000 )
{
_player = player;
_bullets = new List<OctorokBullet>();
_cooldown = cooldown;
_counter = 0;
_bulletTexture = bulletTexture;
_map = map;
}
示例15: IsLockedFor
public static bool IsLockedFor(string nodeName, BaseObject obj){
SceneNode node = null;
if (allNodes.ContainsKey(nodeName)) node =allNodes[nodeName];
if (node != null) return (node.Locked && node.LockingObject()!=obj);
else {
// we could search for a game object of this name with a navNode child and add the component here...
return false; // what to return if not found
}
}