Exemple #1
0
 public override void Execute()
 {
     for (int i = 0; i < Amount; ++i)
     {
         int        randInd = GetRandomConfigIndex();
         Transform  spawn   = GetRandomSpawn();
         NavMeshHit hit;
         if (NavMesh.SamplePosition(spawn.position, out hit, float.MaxValue, ~0))
         {
             MonsterView view = GameObject.Instantiate
                                (
                 Config.EnemiesConfigs[randInd].View.gameObject,
                 hit.position,
                 spawn.rotation
                                )
                                .GetComponent <MonsterView>();
             view.Model = new MonsterModel(Config.EnemiesConfigs[randInd].ModelPrototype);
             view.NavAgent.Warp(hit.position);
         }
     }
 }