Exemplo n.º 1
0
    /// <summary>
    /// 生成敌人类型1
    /// </summary>
    /// <param name="Rooms"></param>
    public void generatingLocation1(List <Transform> Rooms)
    {
        foreach (var item in Rooms)
        {
            RoomEnemy Re = item.gameObject.AddComponent(typeof(RoomEnemy)) as RoomEnemy;
            roomEne.Add(Re);

            GetCollisionDetection(item.transform.Find("CollisionDetection").GetComponentsInChildren <EnterRoom>(), Re);

            SkeletonrInitial SI = item.gameObject.AddComponent(typeof(SkeletonrInitial)) as SkeletonrInitial;
            skeletonrIn.Add(SI);
            Transform    EnemyPos = item.gameObject.transform.Find("EnemyPos");
            SkeletonPhys Sp       = EnemyPos.gameObject.AddComponent(typeof(SkeletonPhys)) as SkeletonPhys;

            SI.skeletonPhys = Sp;

            insPos1.Add(EnemyPos.GetComponentsInChildren <Transform>());
        }
        foreach (var item in insPos1)
        {
            int         a      = Random.Range(1, 4);
            Transform[] enemys = new Transform[a];
            int[]       k      = randomPos(a, item.Length - 1);
            for (int i = 0; i < a; i++)
            {
                enemys[i] = InsEnemy1(item[k[i]]);
            }
            roomEne[roomEneCount].getBehaviorTree(enemys);
            skeletonrIn[roomEneCount].getTransform(enemys);
            roomEneCount++;
        }
    }
Exemplo n.º 2
0
 public void upBehaviors()
 {
     if (roomEnemy.getThisTrans().Count == 0)
     {
         Destroy(skeletonPhys.gameObject);
         behaviors    = null;
         skeletonPhys = null;
         return;
     }
     behaviors = new SkeletonBehaviorTree[roomEnemy.getThisTrans().Count];
     roomEnemy.getThisTrans().CopyTo(behaviors, 0);
     skeletonPhys.EnemyCount = roomEnemy.getThisTrans().Count;
 }