コード例 #1
0
        public virtual void Cast(UnitEntity caster, Vector3Int target, IWorld world)
        {
            HashSet <Vector3Int> aoe     = area.GetAOE(caster.Position, target, world);
            List <UnitEntity>    targets = new List <UnitEntity>();

            foreach (Vector3Int tile in aoe)
            {
                UnitEntity unitAt = world.UnitManager.GetUnitAt <UnitEntity>(tile);
                if (unitAt != null)
                {
                    bool isEnemy = caster.Combat.IsEnemy(unitAt.Combat);
                    if (isEnemy && targetEnemies || !isEnemy && targetFriends)
                    {
                        targets.Add(unitAt);
                    }
                }
            }
            foreach (AbilityEffect effect in effects)
            {
                effect.Apply(caster, targets, world);
            }
        }