本文整理汇总了C#中GameObject.IsValid方法的典型用法代码示例。如果您正苦于以下问题:C# GameObject.IsValid方法的具体用法?C# GameObject.IsValid怎么用?C# GameObject.IsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObject
的用法示例。
在下文中一共展示了GameObject.IsValid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RangeAttackOnCreate
private void RangeAttackOnCreate(GameObject sender, EventArgs args)
{
if (!sender.IsValid<Obj_SpellMissile>())
{
return;
}
var missile = (Obj_SpellMissile) sender;
// Caster ally hero / not me
if (!missile.SpellCaster.IsValid<Obj_AI_Hero>() || !missile.SpellCaster.IsAlly || missile.SpellCaster.IsMe ||
missile.SpellCaster.IsMelee())
{
return;
}
// Target enemy hero
if (!missile.Target.IsValid<Obj_AI_Hero>() || !missile.Target.IsEnemy)
{
return;
}
var caster = (Obj_AI_Hero) missile.SpellCaster;
if (E.IsReady() && E.IsInRange(missile.SpellCaster) && ConfigValue<bool>("Misc.E.AA." + caster.ChampionName))
{
E.Cast(caster); // add delay
}
}
示例2: OnCreateObj_FizzMarinerDoom
private static void OnCreateObj_FizzMarinerDoom(GameObject obj, EventArgs args, SpellData spellData)
{
if (!obj.IsValid<MissileClient>())
return;
MissileClient missile = (MissileClient)obj;
if (missile.SpellCaster != null && missile.SpellCaster.Team != ObjectManager.Player.Team &&
missile.SData.Name == "FizzMarinerDoomMissile")
{
SpellDetector.CreateSpellData(missile.SpellCaster, missile.StartPosition, missile.EndPosition,
spellData, null, 500, true, SpellType.Circular, false, spellData.secondaryRadius);
/*foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells)
{
var spell = entry.Value;
if (spell.info.spellName == "FizzMarinerDoom" &&
spell.spellObject != null && spell.spellObject.NetworkId == missile.NetworkId)
{
if (spell.spellType == SpellType.Circular)
{
spell.spellObject = null;
}
}
}*/
}
}
示例3: ObjMissileClientOnCreate
private static void ObjMissileClientOnCreate(GameObject sender, EventArgs args)
{
if (!sender.IsValid<MissileClient>())
{
return;
}
var missile = (MissileClient) sender;
if (!missile.SpellCaster.IsValid<Obj_AI_Hero>() || missile.SpellCaster.Team == ObjectManager.Player.Team)
{
return;
}
var unit = (Obj_AI_Hero) missile.SpellCaster;
var spellData = SpellDatabase.GetByMissileName(missile.SData.Name);
if (spellData == null)
{
return;
}
var missilePosition = missile.Position.To2D();
var unitPosition = missile.StartPosition.To2D();
var endPos = missile.EndPosition.To2D();
var direction = (endPos - unitPosition).Normalized();
if (unitPosition.Distance(endPos) > spellData.Range || spellData.FixedRange)
{
endPos = unitPosition + direction * spellData.Range;
}
if (spellData.ExtraRange != -1)
{
endPos = endPos +
Math.Min(spellData.ExtraRange, spellData.Range - endPos.Distance(unitPosition)) * direction;
}
var castTime = Utils.GameTimeTickCount - Game.Ping / 2 - (spellData.MissileDelayed ? 0 : spellData.Delay) -
(int) (1000 * missilePosition.Distance(unitPosition) / spellData.MissileSpeed);
TriggerOnDetectSkillshot(DetectionType.RecvPacket, spellData, castTime, unitPosition, endPos, unit);
}
示例4: GameObject_OnCreate
static void GameObject_OnCreate(GameObject obj, EventArgs args)
{
if (obj.IsValid<MissileClient>())
return;
foreach (var troy in Gametroy.Objects)
{
if (obj.Name.Contains(troy.Name) && obj.IsValid<GameObject>())
{
troy.Obj = obj;
troy.Start = Utils.GameTimeTickCount;
if (!troy.Included)
troy.Included = Essentials.HeroInGame(troy.Owner);
}
}
}
示例5: OnObjCreate
private void OnObjCreate(GameObject sender, System.EventArgs args)
{
if (sender.IsValid<Obj_AI_Minion>()
&& sender.IsAlly
&& sender.Name.Equals("ThreshLantern", StringComparison.OrdinalIgnoreCase))
{
LanternObject = sender;
}
}
示例6: GameObject_OnCreate
/// <summary>
/// Handles the OnCreate event of the GameObject class.
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="args">
/// The <see cref="EventArgs" /> instance containing the event data.
/// </param>
private static void GameObject_OnCreate(GameObject sender, EventArgs args)
{
if (!sender.IsAlly || !sender.IsValid<Obj_AI_Base>())
{
return;
}
var obj = (Obj_AI_Base)sender;
if (obj.CharData.BaseSkinName.Equals("syndrasphere"))
{
Orbs.Add(obj);
}
}
示例7: SpellMissile_OnCreate
private void SpellMissile_OnCreate(GameObject obj, EventArgs args)
{
if (!obj.IsValid<Obj_SpellMissile>())
return;
Obj_SpellMissile missile = (Obj_SpellMissile)obj;
SpellData spellData;
if (missile.SpellCaster != null && missile.SpellCaster.Team != myHero.Team &&
missile.SData.Name != null && onMissileSpells.TryGetValue(missile.SData.Name, out spellData)
&& missile.StartPosition != null && missile.EndPosition != null)
{
if (missile.StartPosition.Distance(myHero.Position) < spellData.range + 1000)
{
var hero = missile.SpellCaster;
if (hero.IsVisible)
{
if (spellData.usePackets)
{
CreateSpellData(hero, missile.StartPosition, missile.EndPosition, spellData, obj);
return;
}
foreach (KeyValuePair<int, Spell> entry in spells)
{
Spell spell = entry.Value;
if (spell.info.missileName == missile.SData.Name
&& spell.heroID == missile.SpellCaster.NetworkId)
{
if (spell.info.isThreeWay == false && spell.info.isSpecial == false)
{
spell.spellObject = obj;
//Game.PrintChat("aquired: " + (obj.Position.To2D().Distance(spell.startPos)));
}
}
}
}
else
{
if (Evade.menu.SubMenu("Main").Item("DodgeFOWSpells").GetValue<bool>())
{
CreateSpellData(hero, missile.StartPosition, missile.EndPosition, spellData, obj);
}
}
}
}
}
示例8: GameObject_OnCreate
static void GameObject_OnCreate(GameObject obj, EventArgs args)
{
foreach (var troy in Troy.Troys)
{
if (obj.Name.Contains(troy.Name) && obj.IsValid<GameObject>())
{
troy.Obj = obj;
troy.Start = Utils.GameTimeTickCount;
if (!troy.Included)
troy.Included = true;
}
}
}
示例9: Obj_SpellMissile_OnDelete
private void Obj_SpellMissile_OnDelete(GameObject sender, EventArgs args)
{
if (sender.IsEnemy || sender.Type != GameObjectType.MissileClient || !sender.IsValid<MissileClient>())
return;
MissileClient missile = (MissileClient)sender;
if ( missile.SData.Name != null)
{
if(missile.SData.Name == "AhriOrbReturn")
QMissile = null;
if (missile.SData.Name == "AhriSeduceMissile")
EMissile = null;
}
}
示例10: SpellMissile_OnCreateOld
private void SpellMissile_OnCreateOld(GameObject sender, EventArgs args)
{
if (sender.IsEnemy || sender.Type != GameObjectType.MissileClient || !sender.IsValid<MissileClient>())
return;
MissileClient missile = (MissileClient)sender;
if (missile.SData.Name != null)
{
if (missile.SData.Name == MissileName || missile.SData.Name == MissileReturnName)
{
Missile = missile;
}
}
}
示例11: OnDeleteObj_FizzMarinerDoom
private static void OnDeleteObj_FizzMarinerDoom(GameObject obj, EventArgs args, SpellData spellData)
{
//need to track where bait is attached to
if (!obj.IsValid<MissileClient>())
return;
MissileClient missile = (MissileClient)obj;
if (missile.SpellCaster != null && missile.SpellCaster.Team != ObjectManager.Player.Team &&
missile.SData.Name == "FizzMarinerDoomMissile")
{
SpellDetector.CreateSpellData(missile.SpellCaster, missile.StartPosition, missile.EndPosition,
spellData, null, 1000, true, SpellType.Circular, false, 350);
}
}
示例12: GameObject_OnDelete
static void GameObject_OnDelete(GameObject obj, EventArgs args)
{
if (obj.IsValid<MissileClient>())
return;
foreach (var troy in Gametroy.Objects)
{
if (obj.Name.Contains(troy.Name))
{
troy.Obj = null;
troy.Start = 0;
troy.Limiter = 0; // reset limiter
if (troy.Included)
troy.Included = false;
}
}
}
示例13: ObjMissileClientOnCreate
private static void ObjMissileClientOnCreate(GameObject sender, EventArgs args)
{
if (!sender.IsValid<MissileClient>())
{
return;
}
var missile = (MissileClient) sender;
if (!missile.SpellCaster.IsValid<Obj_AI_Hero>() || missile.SpellCaster.Team == ObjectManager.Player.Team)
{
return;
}
var spellData = SpellDatabase.GetByMissileName(missile.SData.Name);
if (spellData == null)
{
return;
}
Utility.DelayAction.Add(0, () => ObjMissileClientOnCreateDelayed(missile, spellData));
}
示例14: RangeAttackOnCreate
private void RangeAttackOnCreate(GameObject sender, EventArgs args)
{
if (!sender.IsValid<Obj_SpellMissile>())
return;
var missile = (Obj_SpellMissile) sender;
// Caster ally hero / not me
if (!missile.SpellCaster.IsValid<Obj_AI_Hero>() || !missile.SpellCaster.IsAlly ||
missile.SpellCaster.IsMe || !missile.SpellCaster.IsHeroType(HeroType.Ad) ||
missile.SpellCaster.IsMelee())
return;
// Target enemy hero
if (!missile.Target.IsValid<Obj_AI_Hero>() || !missile.Target.IsEnemy)
return;
if (E.IsReady() && E.IsInRange(missile.SpellCaster) && ConfigValue<bool>("MiscE"))
{
E.CastOnUnit(missile.SpellCaster, UsePackets);
}
}
示例15: OnCreateObj_ViktorDeathRay3
private static void OnCreateObj_ViktorDeathRay3(GameObject obj, EventArgs args)
{
if (!obj.IsValid<MissileClient>())
return;
MissileClient missile = (MissileClient)obj;
SpellData spellData;
if (missile.SpellCaster != null && missile.SpellCaster.Team != ObjectManager.Player.Team &&
missile.SData.Name != null && missile.SData.Name == "viktoreaugmissile"
&& SpellDetector.onMissileSpells.TryGetValue("ViktorDeathRay3", out spellData)
&& missile.StartPosition != null && missile.EndPosition != null)
{
var missileDist = missile.EndPosition.To2D().Distance(missile.StartPosition.To2D());
var delay = missileDist / 1.5f + 600;
spellData.spellDelay = delay;
SpellDetector.CreateSpellData(missile.SpellCaster, missile.StartPosition, missile.EndPosition, spellData);
}
}