Ejemplo n.º 1
0
 private static GameEffectWorldMethod CreateMethod_SpawnMinionThrow(string actorDefId, int level, float range, float amount)
 {
     return(delegate(EffectContext context)
     {
         Actor sourceActor = context.sourceActor;
         WeaponBody sourceWeapon = context.sourceWeapon;
         if (!LazySingletonBehavior <NetworkManager> .Instance.IsSimulationServer)
         {
             return;
         }
         SpawnMinions spawnMinions = sourceWeapon as SpawnMinions;
         for (int i = 0; i < (int)amount; i++)
         {
             Vector3 zero = Vector3.zero;
             Quaternion rotation = sourceActor.Rotation;
             if (!SpatialUtil.TryFindRandomSpotCircle(context.hitPoint, context.Radius, range, sourceActor.Height, out zero))
             {
                 Debug.Log("Couln't find valid spawn spot");
             }
             else
             {
                 LazySingletonBehavior <ActorManager> .Instance.Spawn(actorDefId, level, Actor.Faction.Player, /*context.hitPoint*/ zero, /*context.hitRot*/ rotation, delegate(Actor actor)
                 {
                     if (spawnMinions != null && spawnMinions.minionPrefab != null)
                     {
                         GameObject gameObject = spawnMinions.minionPrefab.Spawn(actor.transform);
                         Minion component = gameObject.GetComponent <Minion>();
                         if (component != null)
                         {
                             spawnMinions.AttachMinion(component);
                         }
                     }
                     Debug.Log(string.Concat(new object[]
                     {
                         "Spawned ",
                         actor.DebugName,
                         " at ",
                         actor.transform.position
                     }), actor);
                 });
             }
         }
     });
 }