public void Create(int gameObjectId, GameObjectType gameObjectType, Vector2 position, Vector2 velocity) { GameObjectType = gameObjectType; GameObjectId = gameObjectId; Position = position; Velocity = velocity; }
public static Obj_AI_Base MinionLh(GameObjectType type, AttackSpell spell) { return EntityManager.MinionsAndMonsters.EnemyMinions.OrderBy(a => a.Health).FirstOrDefault(a => a.IsEnemy && a.Type == type && a.Distance( Vladimir) <= Program.Q .Range && !a.IsDead && !a .IsInvulnerable && a .IsValidTarget ( Program .Q .Range) && a.Health <= Misc.Qdmg(a)); }
private static Obj_AI_Base MinionWlh(GameObjectType type, AttackSpell spell) { return EntityManager.MinionsAndMonsters.EnemyMinions.OrderBy(a => a.Health).FirstOrDefault(a => a.IsEnemy && a.Type == type && a.Distance( Kennen) <= Program.W .Range && !a.IsDead && !a .IsInvulnerable && a .IsValidTarget ( Program .W .Range) && a.Health <= Misc.Wcalc(a)); }
public static Obj_AI_Base GetEnemyKS(GameObjectType type, AttackSpell spell) { float range = 0; if (spell == AttackSpell.W) range = Program.W.Range; else if (spell == AttackSpell.R) range = Program.R.Range + (Program.R.Width /2); else if (spell == AttackSpell.Q) range = Program.Q.Range; else if (spell == AttackSpell.Ignite) range = Program.Ignite.Range; //ksing return ObjectManager.Get<Obj_AI_Base>().OrderBy(a => a.Health).Where(a => a.IsEnemy && a.Type == type && a.Distance(Annie) <= range && !a.IsDead && !a.IsInvulnerable && a.IsValidTarget(range) && ( (a.Health <= AnnieCalcs.W(a) && AttackSpell.W == spell) || (a.Health <= AnnieCalcs.Q(a) && AttackSpell.Q == spell) || (a.Health <= AnnieCalcs.R(a) && AttackSpell.R == spell) || (a.Health <= AnnieCalcs.Ignite(a) && AttackSpell.Ignite == spell) )).FirstOrDefault(); }
public static Obj_AI_Base GetEnemy(GameObjectType type, AttackSpell spell) { var eminion = EntityManager.MinionsAndMonsters.GetJungleMonsters(Program.Eve.Position, Program.E.Range) .FirstOrDefault( m => m.Distance(Program.Eve) <= Program.E.Range && m.Health <= Misc.Ecalc(m) && m.IsValidTarget()); if (Program.E.IsReady() && Program.LaneJungleClear["LCE"].Cast<CheckBox>().CurrentValue && eminion != null && !Orbwalker.IsAutoAttacking) { Program.E.Cast(eminion); } if (spell == AttackSpell.Q) { return ObjectManager.Get<Obj_AI_Base>().OrderBy(a => a.Health).FirstOrDefault(a => a.IsEnemy && a.Type == type && a.Distance(Evelynn) <= Program.Q.Range && !a.IsDead && !a.IsInvulnerable && a.IsValidTarget( Program.Q.Range) && a.Health <= Misc.Qcalc(a)); } return null; }
public static Obj_AI_Base GetEnemyKS(GameObjectType type, AttackSpell spell) { float range = 0; if (spell == AttackSpell.Q) range = Program.Q.Range; else if (spell == AttackSpell.E) range = Program.E.Range; else if (spell == AttackSpell.W) range = Program.W.Range; else if (spell == AttackSpell.Ignite) range = Program.Ignite.Range; //ksing return ObjectManager.Get<Obj_AI_Base>().OrderBy(a => a.Health).Where(a => a.IsEnemy && a.Type == type && a.Distance(Ryze) <= range && !a.IsDead && !a.IsInvulnerable && a.IsValidTarget(range) && ( (a.Health <= RyzeCalcs.W(a) && AttackSpell.W == spell) || (a.Health <= RyzeCalcs.Q(a) && Program.Q.GetPrediction(a).HitChance >= HitChance.Low && AttackSpell.Q == spell) || (a.Health <= RyzeCalcs.E(a) && AttackSpell.E == spell) || (a.Health <= RyzeCalcs.Ignite(a) && AttackSpell.Ignite == spell) )).FirstOrDefault(); }
public GameObject CreateNewObject(GameObjectType type) { GameObject go = null; switch (type) { case GameObjectType.Stone: go = GameObject.Instantiate(ObjectPoolObjects.Instance.Stones[UnityEngine.Random.Range(0, ObjectPoolObjects.Instance.Stones.Count)]); break; case GameObjectType.Tree: go = GameObject.Instantiate(ObjectPoolObjects.Instance.Trees[UnityEngine.Random.Range(0, ObjectPoolObjects.Instance.Trees.Count)]); break; case GameObjectType.Decoration: //go = GameObject.Instantiate(MapGenerator.GetInstance().decoration[UnityEngine.Random.Range(0, MapGenerator.GetInstance().decoration.Count)]); break; } if (go != null) { PoolList list = this.GetList(type); if (list != null) { list.AddGameObject(go); } } return go; }
public static Obj_AI_Base GetBestELocation(GameObjectType type) { var numEnemiesInRange = 0; Obj_AI_Base enem = null; foreach (var enemy in ObjectManager.Get<Obj_AI_Base>() .OrderBy(a => a.Health) .Where(a => a.Distance(Vladimir) <= Program.E.Range && a.IsEnemy && a.Type == type && !a.IsDead && !a.IsInvulnerable)) { var tempNumEnemies = ObjectManager.Get<Obj_AI_Base>() .OrderBy(a => a.Health) .Where( a => a.Distance(Vladimir) <= Program.E.Range && a.IsEnemy && !a.IsDead && a.Type == type && !a.IsInvulnerable) .Count(enemy2 => enemy != enemy2 && enemy2.Distance(enemy) <= 75); if (tempNumEnemies > numEnemiesInRange) { enem = enemy; numEnemiesInRange = tempNumEnemies; } } return enem; }
public static Obj_AI_Base GetEnemyKS(GameObjectType type, AttackSpell spell, bool EwithQ = false) { float range = 0; if (spell == AttackSpell.Q) range = Program.Q.Range; else if (spell == AttackSpell.E) range = Program.E.Range + 200; else if (spell == AttackSpell.Ignite) range = Program.Ignite.Range; else if (spell == AttackSpell.R) range = int.MaxValue; //ksing return ObjectManager.Get<Obj_AI_Base>().OrderBy(a => a.Health).Where(a => a.IsEnemy && a.Type == type && a.Distance(GP) <= range && !a.IsDead && !a.IsInvulnerable && a.Name != "Barrel" && a.IsValidTarget(range) && ( (a.Health <= GPCalcs.Q(a) && AttackSpell.Q == spell && !NearbyBarrel(350, a.Position)) || (a.Health <= GPCalcs.E(a, EwithQ) && AttackSpell.E == spell) || (a.Health <= (GPCalcs.RDamagePerWave(a) * 8) && AttackSpell.R == spell) || (a.Health <= GPCalcs.Ignite(a) && AttackSpell.Ignite == spell) )).FirstOrDefault(); }
/// <summary> /// Construct a game object and insert it into an object table. /// </summary> /// <param name="ObjectId">The engine object id.</param> /// <param name="ObjectType">The object type code.</param> /// <param name="ObjectManager">The object manager to attach the object /// to.</param> public GameObject(uint ObjectId, GameObjectType ObjectType, GameObjectManager ObjectManager) { this.GameObjectId = ObjectId; this.GameObjectTypeCode = ObjectType; this.ObjectManager = ObjectManager; ObjectManager.AddGameObject(this); }
// Grab Ally public static Obj_AI_Base GetAlly(float range, GameObjectType gametype) { return ObjectManager.Get<Obj_AI_Base>() .OrderBy(a => a.Health).FirstOrDefault(a => a.IsAlly && a.Type == gametype && !Player.IsRecalling() && !a.IsDead && a.IsValidTarget(range) && !a.IsInvulnerable && a.Distance(Player) <= range); }
public static Obj_AI_Base GetEnemy(float range, GameObjectType t) { switch (t) { default: return EntityManager.Heroes.Enemies.OrderBy(a => a.Health).FirstOrDefault( a => a.Distance(Player.Instance) < range && !a.IsDead && !a.IsInvulnerable); } }
/// <summary> /// Look up the internal GameObject for an object by object id and /// return the C# object state for it, if the object type matched the /// expected type. /// /// The routine does not create the object state for an object id /// that is valid but unrecognized to us (i.e. that we have not yet /// seen even though it exists engine-side). /// </summary> /// <param name="ObjectId">Supplies the object id to look up.</param> /// <param name="ObjectType">Supplies the required object type.</param> /// <returns>The corresponding C# object state, else null.</returns> public GameObject GetGameObject(uint ObjectId, GameObjectType ObjectType) { GameObject GameObj = GetGameObject(ObjectId); if (GameObj == null || GameObj.ObjectType != ObjectType) return null; else return GameObj; }
public static Obj_AI_Base GetEnemy(float range, GameObjectType type) { return ObjectManager.Get<Obj_AI_Base>().OrderBy(a => a.Health).Where(a => a.IsEnemy && a.Type == type && a.Distance(Annie) <= range && !a.IsDead && !a.IsInvulnerable && a.IsValidTarget(range)).FirstOrDefault(); }
/// <summary> /// Creates an instance of a game object using the specified type and content. /// </summary> /// <param name="type">The type of game object to create.</param> /// <param name="spriteContent">The image content to use for the game object's sprite.</param> public GameObject(GameObjectType type, string spriteContent) : this() { // Set the type of game object Type = type; // Initialize the sprite with the specified content InitWithFile(spriteContent); }
public Projectile(Game game, Model model, Vector3 pos, Vector3 vel, GameObjectType targetType) : base(game) { this.model = model; this.pos = pos; this.vel = vel; this.targetType = targetType; squareHitRadius = hitRadius * hitRadius; }
// Constructor. public Projectile(LabGame game, MyModel myModel, Vector3 pos, Vector3 vel, GameObjectType targetType) { this.game = game; this.myModel = myModel; this.pos = pos; this.vel = vel; this.targetType = targetType; squareHitRadius = hitRadius * hitRadius; GetParamsFromModel(); }
// Grab KSable Enemy public static Obj_AI_Base GetKs(float range, float damage, GameObjectType gametype) { return ObjectManager.Get<Obj_AI_Base>() .OrderBy(a => a.Health).FirstOrDefault(a => a.IsEnemy && a.Type == gametype && !a.IsDead && a.IsValidTarget(range) && !a.IsInvulnerable && !a.HasBuff("ChronoShift") && a.Health <= damage && a.Distance(Champion) <= range); }
public static Obj_AI_Base MinionLh(GameObjectType type, AttackSpell spell) { return ObjectManager.Get<Obj_AI_Base>() .OrderBy(a => a.Health) .FirstOrDefault( a => a.IsEnemy && a.Type == type && a.Distance(Morgana) <= Program.Q.Range && !a.IsDead && !a.IsInvulnerable && a.IsValidTarget(Program.Q.Range) && a.Health <= Qcalc(a)); }
public GameObject GetObject(GameObjectType type) { PoolList list = this.GetList(type); if (list != null) { return list.GetNextAvaiableObject(); } this._objectList.Add(new PoolList(type)); return this.GetObject(type); }
private static Obj_AI_Base GetEnemy(float range, GameObjectType t) { switch (t) { case GameObjectType.AIHeroClient: return EntityManager.Heroes.Enemies.OrderBy(a => a.Health).FirstOrDefault( a => a.Distance(Player.Instance) < range && !a.IsDead && !a.IsInvulnerable); default: return EntityManager.MinionsAndMonsters.EnemyMinions.OrderBy(a => a.Health).FirstOrDefault( a => a.Distance(Player.Instance) < range && !a.IsDead && !a.IsInvulnerable); } }
public int getLayer(GameObjectType pType) { switch (pType) { case GameObjectType.virtualObject:return virtualObjectLayer; break; case GameObjectType.generalObject: return generalObjectLayer; break; } throw new System.InvalidOperationException("Invalid GameObjectType"); return -1; }
private PoolList GetList(GameObjectType type) { for (int i = 0; i < this._objectList.Count; i++) { if (this._objectList[i].GetGameObjectType() == type) { return this._objectList[i]; } } return null; }
} // rotation in radians public GameObject(string bitmapPath, PointF position = default(PointF), SizeF size = default(SizeF), GameObjectType type = GameObjectType.None, float rotation = 0, string subtype = null) { Type = type; BitmapPath = bitmapPath; Subtype = subtype; SpriteTextureHandle = -1; m_colorMask = Color.FromArgb(0, 0, 0); Position = position; Size = size; Rotation = rotation; }
public static Obj_AI_Base GetEnemy(float range, GameObjectType t) { switch (t) { case GameObjectType.AIHeroClient: return(EntityManager.Heroes.Enemies.OrderBy(a => a.Health).FirstOrDefault( a => a.Distance(Player.Instance) < range && !a.IsDead && !a.IsInvulnerable)); default: return(EntityManager.MinionsAndMonsters.EnemyMinions.OrderBy(a => a.Health).FirstOrDefault( a => a.Distance(Player.Instance) < range && !a.IsDead && !a.IsInvulnerable)); } }
public static Obj_AI_Base GetEnemy(GameObjectType type, AttackSpell spell) { if (spell == AttackSpell.E) { return(ObjectManager.Get <Obj_AI_Base>().OrderBy(a => a.Health).FirstOrDefault(a => a.IsEnemy && a.Type == type && a.Distance(Vladimir) <= Program.E.Range && !a.IsDead && !a.IsInvulnerable && a.IsValidTarget( Program.E.Range) && a.Health <= Misc.Edmg(a))); } if (spell == AttackSpell.Q) { return(ObjectManager.Get <Obj_AI_Base>().OrderBy(a => a.Health).FirstOrDefault(a => a.IsEnemy && a.Type == type && a.Distance(Vladimir) <= Program.Q.Range && !a.IsDead && !a.IsInvulnerable && a.IsValidTarget( Program.Q.Range) && a.Health <= Misc.Qdmg(a))); } var target = TargetSelector.GetTarget(1500, DamageType.True); if (target == null || !target.IsValid()) { if (Program.Ignite.IsInRange(target) && target.Health < 50 + 20 * Program._Player.Level - (target.HPRegenRate / 5 * 3) && Program.ComboMenu["useignite"].Cast <CheckBox>().CurrentValue) { Program.Ignite.Cast(target); } } { Chat.Print("igniteused"); } return(null); }
public void RemoveObjectConfig() { GameObjectType currenType = Application.application.SelectedGameObjectType; if (currenType != GameObjectType.Default) { MapConfig.mapConfig.RemoveConfig(currenType); currectObjectType = GameObjectType.Default; } else { Debug.Log("Game object type is not specified."); } }
private void ShowTypeProperties(GameObjectType gameObjectType) { if (gameObjectType == null) { return; } using (TypeSettings typeSettings = new TypeSettings()) { typeSettings.Type = gameObjectType; typeSettings.ShowDialog(); Refresh(); } }
public PlayerProjectile(Vector2 p, GameObjectType obj_id, int unq_id, int isClient, bool updatable, Vector2 frameSize, ColliderOffset coloffset) : base(p, obj_id, unq_id, isClient, updatable, frameSize, coloffset) { if (m_CollisionObjects.Count == 0) { foreach (GameObject go in GameSimulation.instance.GetObjects()) { if (WantToCollideWith(go.TypeId())) { m_CollisionObjects.Add(go); } } } }
public static Label From(GameObjectType type) { var label = new Label(); label.TextAlign = ContentAlignment.MiddleRight; label.Font = new Font(Label.DefaultFont, FontStyle.Bold); if (typeNames.ContainsKey(type)) { label.Text = typeNames[type]; } return(label); }
public void RemoveConfig(GameObjectType type) { var objectOfThatType = placeableObjectConfigs.FirstOrDefault(config => config.type.Equals(type)); if (objectOfThatType != null) { placeableObjectConfigs.Remove(objectOfThatType); Debug.Log("GameObjecType " + type.ToString() + " was removed from the config list."); } else { Debug.Log("GameObjecType " + type.ToString() + " is not accessible in the config list"); } }
public bool Remove(int objectId) { GameObjectType objectType = GetObjectById(objectId); lock (_lock) { if (objectType == GameObjectType.Player) { return(_players.Remove(objectId)); } } return(false); }
/// <summary> /// Handler for the add unit button. /// </summary> /// <param name="sender">Object that triggered the event.</param> /// <param name="args">Arguments for the AddButtonClicked Event.</param> private void AddHandler(object sender, EventArgs args) { Command command; GameObjectType type = GameObjectFactory.The.getType("TestUnit"); foreach (ActiveGameObject o in _selectedObjects) { command = new AddDecorator(o.ID, 0, type.ID, new TimeSpan(), new Command()); if (NewCommandEvent != null) { NewCommandEvent.Invoke(this, new NewCommandEventArgs(command)); } } }
public virtual void Start() { EasyTouch.SetEnableAutoSelect(true); realType = GameObjectType.Obj_3D; if (GetComponent <Collider>()) { realType = GameObjectType.Obj_3D; } else if (GetComponent <Collider2D>()) { realType = GameObjectType.Obj_2D; } else if (GetComponent <CanvasRenderer>()) { realType = GameObjectType.UI; } switch (realType) { case GameObjectType.Obj_3D: LayerMask mask = EasyTouch.Get3DPickableLayer(); mask = mask | 1 << gameObject.layer; EasyTouch.Set3DPickableLayer(mask); break; //2D case GameObjectType.Obj_2D: EasyTouch.SetEnable2DCollider(true); mask = EasyTouch.Get2DPickableLayer(); mask = mask | 1 << gameObject.layer; EasyTouch.Set2DPickableLayer(mask); break; // UI case GameObjectType.UI: EasyTouch.instance.enableUIMode = true; EasyTouch.SetUICompatibily(false); break; } if (enablePickOverUI) { EasyTouch.instance.enableUIMode = true; EasyTouch.SetUICompatibily(false); } }
public static Vector3 GetBestCircularCastPosition(GameObjectType type, Spell spell, int minHits, int spellRadius) { IEnumerable <Obj_AI_Base> entities = type.Equals(GameObjectType.AIHeroClient) ? Globals.GetEnemies.Where(x => x.IsValidTarget(spell.Range)) : MinionManager.GetMinions(spell.Range, MinionTypes.All, MinionTeam.Enemy, MinionOrderTypes.Health); if (!entities.Any()) { return(Vector3.Zero); } List <Obj_AI_Base> bestEnemies = new List <Obj_AI_Base>(); foreach (Obj_AI_Base entity in entities) { int hitCount = 0; foreach (Obj_AI_Base entity2 in entities) { if (entity.Position.Distance(entity2.Position) <= 2 * spellRadius) { hitCount++; } if (hitCount >= minHits) { bestEnemies.Add(entity); } } } if (bestEnemies.Count < minHits || !bestEnemies.Any()) { return(Vector3.Zero); } float Xs = 0; float Zs = 0; foreach (Obj_AI_Base enemy in bestEnemies) { Xs += enemy.Position.X; Zs += enemy.Position.Z; } float avgX = Xs / bestEnemies.Count; float avgZ = Zs / bestEnemies.Count; Vector2 bestPosition = new Vector2(avgX, avgZ); return(bestPosition.Distance(ObjectManager.Me.Position.To2D()) <= spell.Range ? bestPosition.To3D() : Vector3.Zero); }
public void AddObject(GameObjectType type, string group, LevelObject levelObject) { if (!ObjectTable.ContainsKey(type)) { ObjectTable[type] = new Dictionary <string, List <LevelObject> >(); } if (!ObjectTable[type].ContainsKey(group)) { ObjectTable[type][group] = new List <LevelObject>(); } ObjectTable[type][group].Add(levelObject); AllObjects.Add(levelObject); }
private static GameObject CreateGameObject(GameObjectType gameObjectType) { if (true == gameObjectDictionary.ContainsKey(gameObjectType)) { return(gameObjectDictionary[gameObjectType]); } GameObject gameObject = new GameObject(); gameObject.name = gameObjectType.ToString(); GameObject.DontDestroyOnLoad(gameObject); gameObjectDictionary.Add(gameObjectType, gameObject); return(gameObject); }
public GameObject CreateObjectAtPosition( Guid id, Position position, GameObjectType gameObjectType, int size) { var gameObject = new GameObject(); gameObject.Id = id; gameObject.Size = size; gameObject.Position = position; gameObject.GameObjectType = gameObjectType; return(gameObject); }
public GameObject CreateGameObject(GameObjectType gameObjectType) { var gameObject = new GameObject(_publisher, gameObjectType); _world.AddGameObject(gameObject); var components = _componentsFactory.GetComponents(gameObjectType); foreach (var component in components) { gameObject.AddComponent(component); } return(gameObject); }
public static Obj_AI_Base MinionLH(GameObjectType type, AttackSpell spell) { return(ObjectManager.Get <Obj_AI_Base>().OrderBy(a => a.Health).FirstOrDefault(a => a.IsEnemy && a.Type == type && a.Distance(Vladimir) <= Program.Q.Range && !a.IsDead && !a.IsInvulnerable && a.IsValidTarget( Program.Q.Range) && a.Health <= Misc.Qdmg(a))); }
public bool Remove(int objectId) { GameObjectType objectType = GetObjectTypeById(objectId); lock (_lock) { if (objectType == GameObjectType.Player) { return(_players.Remove(objectId)); } } // 플레이어 빼면 여기서는 다른 오브젝트들을 모른다. -> 못지움 return(false); }
public GameCardInZone( int instanceId, int ownerSeatId, OwnedZone zone, int grpId, GameObjectType gameObjectType, Visibility visibility, Card card) : base(instanceId, grpId) { OwnerSeatId = ownerSeatId; Zone = zone; GameObjectType = gameObjectType; Visibility = visibility; Card = card; }
public static bool HierarchyHasObjectsOfType(this GameObject root, GameObjectType typeFlags) { var allObjects = root.GetAllChildrenAndSelf(); foreach (var gameObj in allObjects) { GameObjectType objectType = gameObj.GetGameObjectType(); if ((typeFlags & objectType) != 0) { return(true); } } return(false); }
public static Obj_AI_Base MinionLh(GameObjectType type, AttackSpell spell) { return(EntityManager.MinionsAndMonsters.EnemyMinions.OrderBy(a => a.Health).FirstOrDefault(a => a.IsEnemy && a.Type == type && a.Distance(Kennen) <= Program.Q.Range && !a.IsDead && !a.IsInvulnerable && a.IsValidTarget( Program.Q.Range) && a.Health <= Misc.Qcalc(a))); }
private static Obj_AI_Base MinionLh(GameObjectType type, AttackSpell spell) { return(ObjectManager.Get <Obj_AI_Base>().OrderBy(a => a.Health).FirstOrDefault(a => a.IsEnemy && a.Type == type && a.Distance(Annie) <= Program.Q.Range && !a.IsDead && !a.IsInvulnerable && a.IsValidTarget( Program.Q.Range) && a.Health <= Qcalc(a))); }
public static Obj_AI_Base GetEnemy(GameObjectType type, AttackSpell spell) { if (spell == AttackSpell.E) { return ObjectManager.Get<Obj_AI_Base>().OrderBy(a => a.Health).FirstOrDefault(a => a.IsEnemy && a.Type == type && a.Distance(Vladimir) <= Program.E.Range && !a.IsDead && !a.IsInvulnerable && a.IsValidTarget( Program.E.Range) && a.Health <= Misc.Edmg(a)); } if (spell == AttackSpell.Q) { return ObjectManager.Get<Obj_AI_Base>().OrderBy(a => a.Health).FirstOrDefault(a => a.IsEnemy && a.Type == type && a.Distance(Vladimir) <= Program.Q.Range && !a.IsDead && !a.IsInvulnerable && a.IsValidTarget( Program.Q.Range) && a.Health <= Misc.Qdmg(a)); } var target = TargetSelector.GetTarget(1500, DamageType.True); if (target == null || !target.IsValid()) if (Program.Ignite.IsInRange(target) && target.Health < 50 + 20*Program._Player.Level - (target.HPRegenRate/5*3) && Program.ComboMenu["useignite"].Cast<CheckBox>().CurrentValue) { Program.Ignite.Cast(target); } { Chat.Print("igniteused"); } return null; }
public CarAgent(Model model, float modelRotate, float width, float height, bool opposite, GameObjectType type, IGameStateProvider gameStateProvider, IControlStrategy drivingStrategy) : base(model, true) { _gameStateProvider = gameStateProvider; Width = width; HardCodedHeight = height; ModelRotate = modelRotate; OppositeDirection = opposite; if (drivingStrategy != null) { _strategy = drivingStrategy; _strategy.GameObject = this; } Type = type; Id = Guid.NewGuid().ToString(); }
public void AddConfig(GameObjectType type, float removalCosts, float placementCosts) { var objectOfThatType = placeableObjectConfigs.FirstOrDefault(config => config.type.Equals(type)); if (objectOfThatType != null) { objectOfThatType.removalCosts = removalCosts; objectOfThatType.placementCosts = placementCosts; Debug.Log("Changed in user map: " + type.ToString() + ", Placement costs changed: " + placementCosts + ", Removal costs changed: " + removalCosts); } else { placeableObjectConfigs.Add(new ObjectConfig(type, removalCosts, placementCosts)); Debug.Log("Added to user map: " + type.ToString() + ", Placement costs: " + placementCosts + ", Removal costs: " + removalCosts); } }
protected override void GameObjectUpdatedDelegate(GameObjectType type) { if (type != GameObjectType.Animation) { return; } InitEditor(); if (mEditorItem == null || AnimationBase.Lookup.Values.Contains(mEditorItem)) { return; } mEditorItem = null; UpdateEditor(); }
public GameObject(Game1 game, GameObjectType type, String name, float size, Vector2 pos, float vel, bool draggable, int layer) { this.game = game; this.name = name; this.type = type; this.img = game.Content.Load<Texture2D>("Graphics\\" + name); this.size = size; this.pos = pos; this.vel = vel; this.draggable = draggable; this.layer = layer; touched = false; game.Add(this); }
public void CollisionResponse(GameObjectType object1, GameObjectType object2, CollisionEngine.CollisionSide side) { Tuple <GameObjectType, GameObjectType, CollisionEngine.CollisionSide> key = Tuple.Create(object1, object2, side); if (crLookupTable.ContainsKey(key)) { crLookupTable[key].Execute(); } else { key = Tuple.Create(object2, object1, side); if (crLookupTable.ContainsKey(key)) { crLookupTable[key].Execute(); } } }
public static Obj_AI_Base GetEnemy(Abilities ability, GameObjectType type) { float range = 0; if (ability == Abilities.Q) range = Program.QRange; else if (ability == Abilities.W) range = Program.WRange; else if (ability == Abilities.Slice || ability == Abilities.Dice) range = Program.E.Range; return ObjectManager.Get<Obj_AI_Base>().OrderBy(a => a.Health).Where(a => a.IsEnemy && a.Type == type && a.Distance(Renekton) <= range && !a.IsDead && !a.IsInvulnerable && a.IsValidTarget(range)).FirstOrDefault(); }
void Start() { Debug.Log("BUTTON LIST CONTROL"); foreach (var VARIABLE in imageResolverList.imageResolverItems) { Debug.Log(VARIABLE.Type); } buttons = new List <GameObject>(); if (buttons.Count > 0) { foreach (GameObject button in buttons) { Destroy(button.gameObject); } buttons.Clear(); } for (int i = 0; i < GetObjectsCount() - 1; i++) { GameObject button = Instantiate(buttonTemplate); GameObjectType type = GetEnumValue(i); button.SetActive(true); button.GetComponent <ButtonListButton>().SetText("Available"); button.GetComponent <ButtonListButton>().ObjectType = type; button.GetComponent <ButtonListButton>().SetImage(GetSpriteFromResolver(type)); button.GetComponent <ButtonListButton>().Id = i.ToString(); buttons.Add(button); int placementCosts = 0; int removalCosts = 0; bool Available = false; if (!Application.application.SelectedGameObjectType.Equals(GameObjectType.Default)) { placementCosts = (int)MapConfig.mapConfig.GetPlacementCosts(Application.application.SelectedGameObjectType); removalCosts = (int)MapConfig.mapConfig.GetRemovalCosts(Application.application.SelectedGameObjectType); Available = MapConfig.mapConfig.IsContained(Application.application.SelectedGameObjectType); } button.GetComponent <ButtonListButton>().Available = Available; button.GetComponent <ButtonListButton>().SetValues(placementCosts, removalCosts); button.transform.SetParent(buttonTemplate.transform.parent, false); } }
// 딕셔너리에서 찾기 public GameObject Find(int objectId) { GameObjectType objectType = GetObjectTypeById(objectId); lock (_lock) { if (objectType == GameObjectType.Player) { GameObject obj = null; if (_objects.TryGetValue(objectId, out obj)) { return(obj); } } } return(null); }
public byte[] MakeAddAgent(Vector3 pos, GameObjectType gameObjectType = GameObjectType.Monster) { var builder = new FlatBufferBuilder(1024); AddAgent.StartAddAgent(builder); //AddAgent.AddPos(builder, Vec3.CreateVec3(builder, -1.4f, 0.69f, 2.68f)); AddAgent.AddPos(builder, Vec3.CreateVec3(builder, pos.x, pos.y, pos.z)); AddAgent.AddGameObjectType(builder, gameObjectType); var offset = AddAgent.EndAddAgent(builder); var msg = GameMessage.CreateGameMessage(builder, GameMessages.AddAgent, offset.Value); builder.Finish(msg.Value); byte[] body = builder.SizedByteArray(); return body; }
private void SyncTargets() { if (GradiusOption.instance.includeModelInsideOrb && NetworkServer.active && NetworkUser.AllParticipatingNetworkUsersReady() && targetIds.Count > 0) { Tuple <GameObjectType, NetworkInstanceId, short, NetworkInstanceId>[] listCopy = new Tuple <GameObjectType, NetworkInstanceId, short, NetworkInstanceId> [targetIds.Count]; targetIds.CopyTo(listCopy); targetIds.Clear(); for (int i = 0; i < listCopy.Length; i++) { GameObjectType gameObjectType = listCopy[i].Item1; NetworkInstanceId netId = listCopy[i].Item2; short numbering = listCopy[i].Item3; NetworkInstanceId targetId = listCopy[i].Item4; new SyncOptionTarget(gameObjectType, netId, numbering, targetId).Send(NetworkDestination.Clients); } } }
public Player(GameManager gameManager) { _gameManager = gameManager; var initialPosition = new Vector2(300, 350); _playerImage = new ImageFile { ImagePath = @"Images\Player", Position = initialPosition, }; _animationEffect = new SpriteSheetEffect(new Vector2(4, 2), 100); _rotateImageEffect = new RotateImageEffect(180, 100) { IsActive = false }; _playerImage.ActivateEffect(_animationEffect); _playerImage.ActivateEffect(_rotateImageEffect); _playerDieSound = new SoundFile(gameManager.SoundManager, @"Effects\Crash"); _changePlayerSound = new SoundFile(gameManager.SoundManager, @"Effects\Change"); _wingFlappingSound = new SoundFile(gameManager.SoundManager, @"Effects\WingFlapping"); _currentType = gameManager.PlayerStats.CurrentPlayerType; }
public static Obj_AI_Base GetEnemy(GameObjectType type, AttackSpell spell) { if (spell == AttackSpell.Q) { return ObjectManager.Get<Obj_AI_Base>().OrderBy(a => a.Health).FirstOrDefault(a => a.IsEnemy && a.Type == type && a.Distance(Kennen) <= Program.Q.Range && !a.IsDead && !a.IsInvulnerable && a.IsValidTarget( Program.Q.Range) && a.Health <= Misc.Qcalc(a)); } return null; }
// Constructor for the player as the shooter public Projectile(ProjectGame game, string model_name, Vector3 pos, float velocity, Enemy target, GameObjectType targetType) { this.game = game; this.pos = pos; this.velocity = velocity; this.target = target; this.targetType = targetType; hitRadius = 5; squareHitRadius = hitRadius * hitRadius; collisionRadius = squareHitRadius; scaling = 1.5f; model = game.Content.Load<Model>(model_name); basicEffect = new BasicEffect(game.GraphicsDevice) { World = Matrix.Identity, View = game.camera.View, Projection = game.camera.Projection }; BasicEffect.EnableDefaultLighting(model, true); }
// Constructor with the enemy as the shooter public Projectile(ProjectGame game, Enemy shooter, Vector3 pos, float velocity, Vector3 targetPos, GameObjectType targetType) { this.game = game; this.shooter = shooter; this.pos = pos; this.velocity = velocity; this.targetPos = targetPos; this.targetType = targetType; squareHitRadius = hitRadius * hitRadius; collisionRadius = squareHitRadius; isTargetPlayer = true; scaling = 8; model = game.Content.Load<Model>("Sphere"); basicEffect = new BasicEffect(game.GraphicsDevice) { World = Matrix.Identity, View = game.camera.View, Projection = game.camera.Projection }; BasicEffect.EnableDefaultLighting(model, true); }