public int CreateSpecialEffect(string specialEffectType) { GameObject obj = null; if (specialEffectType == "specialEffect_basicProjectile") { obj = new SpecialEffect_BasicProjectile(GetNextID()); } else if (specialEffectType == "specialEffect_basicMelee") { obj = new SpecialEffect_BasicMelee(GetNextID()); } else if (specialEffectType == "specialEffect_basicBlast") { obj = new SpecialEffect_BasicBlast(GetNextID()); } else { throw new NotImplementedException(); } return(RegisterGameObject(obj)); }
public override void Activate() { StartEffect(); if (_sourceTile != null) { _attack.SourceCoordinate = _sourceTile; } if (_targetTile != null) { _attack.TargetCoordinate = _targetTile; } //First check to see if the attack will get to its intended target List <IntVector2> path = _scene.GetBestRouteBetweenPositions(_attack.SourceCoordinate, _attack.TargetCoordinate); _attack.TargetCoordinate = path.Last(); //Show attack special effect and trigger rest of attack when finished int fxId = _scene.GetGameObjectPool().CreateSpecialEffect("specialEffect_basicMelee"); SpecialEffect_BasicMelee fx = (SpecialEffect_BasicMelee)_scene.GetGameObjectPool().GetSpecialEffect(fxId); fx.Init(_attack.SourceCoordinate, _attack.TargetCoordinate, new SpecialEffect.OnSpecialEffectEndCallback(OnSpecialEffectEnd)); _scene.AddSpecialEffect(fxId); }