Пример #1
0
 void Start()
 {
     Screen.SetResolution(1280, 720, true);
     charsInRound = new int[] { 1, 1, 1, 1, 1, 4, 4, 4, 4, 4 };
     spawner      = GameObject.Find("Spawner").GetComponent <C_Spawner>();
     foreach (Transform window in GameObject.Find("Window").transform)
     {
         NGUITools.SetActive(window.gameObject, false);
     }
     if (!SaveController.instance.newGame)
     {
         SaveController.instance.prepareLoadedLevel();
     }
     else
     {
         boss = Instantiate(BossHolder.instance.boss, bossSpawnPoint, BossHolder.instance.boss.transform.rotation) as GameObject;
     }
     talentWindow.GetComponent <TalentWindow>().initialize();
     bossC = boss.GetComponent <C_Boss>();
     bossM = boss.GetComponent <M_Boss>();
     Bottombar.instance.l_bossLabel.text = bossM.eName;
     InvokeRepeating("increaseGrudge", 5f, 5f);
     Invoke("startNextDefense", 1f);
     gameState = (int)GameState.PREPARATION;
 }
Пример #2
0
    // Lets you convert the editor data representation to the entity optimal runtime representation
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        var spawnerData = new C_Spawner
        {
            // The referenced prefab will be converted due to DeclareReferencedPrefabs.
            // So here we simply map the game object to an entity reference to that prefab.
            Prefab = conversionSystem.GetPrimaryEntity(Prefab),
            Count  = Count
        };

        dstManager.AddComponentData(entity, spawnerData);
    }
Пример #3
0
    // Start is called before the first frame update
    void Start()
    {
        EntityManager entityManager = World.Active.EntityManager;

        YellowBeeEnt = GameObjectConversionUtility.ConvertGameObjectHierarchy(YellowBeePrefab, World.Active);
        PurpleBeeEnt = GameObjectConversionUtility.ConvertGameObjectHierarchy(PurpleBeePrefab, World.Active);

        SpawnerEnt = GameObjectConversionUtility.ConvertGameObjectHierarchy(SpawnerPrefab, World.Active);

        C_Spawner yellowSpawnData = new C_Spawner()
        {
            Count  = beesAtStart / 2,
            Prefab = YellowBeeEnt
        };
        C_Spawner purpleSpawnData = new C_Spawner()
        {
            Count  = beesAtStart / 2,
            Prefab = PurpleBeeEnt
        };

        //Spawn yellows
        var spawner = entityManager.CreateEntity();

        entityManager.AddComponentData(spawner, yellowSpawnData);
        entityManager.AddComponentData(spawner, new Unity.Transforms.LocalToWorld()
        {
            Value = YellowSpawnPoint.localToWorldMatrix
        });

        //Spawn purples
        spawner = entityManager.CreateEntity();

        entityManager.AddComponentData(spawner, purpleSpawnData);
        entityManager.AddComponentData(spawner, new Unity.Transforms.LocalToWorld()
        {
            Value = PurpleSpawnPoint.localToWorldMatrix
        });
    }
Пример #4
0
        public void Execute(Entity ent, int index, [ReadOnly] ref C_GridIndex Grid, ref Translation Position)
        {
            float floorY = GetStackPos(Grid.x, Grid.y, StackHeights[GridIndex(Grid.x, Grid.y)]).y;

            if (Position.Value.y > floorY)
            {
                return;
            }

            Position.Value.y = floorY;
            if (abs(Position.Value.x) > Field.x * .4f)
            {
                C_Spawner BeeSpawnData = new C_Spawner()
                {
                    Count = BeesPerResource
                };
                BeeSpawnData.Prefab = PurpleBeePrefab;
                if (Position.Value.x > 0f)
                {
                    BeeSpawnData.Prefab = YellowBeePrefab;
                }

                var localToWorld = new LocalToWorld()
                {
                    Value = float4x4(quaternion(0, 0, 0, 1), Position.Value)
                };

                var spawner = ecb.Instantiate(SpawnerPrefab);
                ecb.SetComponent(spawner, BeeSpawnData);
                ecb.SetComponent(spawner, localToWorld);

                //Spawn Smoke

                C_Spawner SmokeSpawnData = new C_Spawner()
                {
                    Count  = 5,
                    Prefab = SmokePrefab
                };

                spawner = ecb.Instantiate(SpawnerPrefab);
                ecb.SetComponent(spawner, SmokeSpawnData);
                ecb.SetComponent(spawner, localToWorld);

                ecb.DestroyEntity(ent);
            }
            else
            {
                int stackIndex = StackHeights[GridIndex(Grid.x, Grid.y)];
                if ((stackIndex + 1) * ResourceSize < Field.y)
                {
                    C_Stack stack = new C_Stack()
                    {
                        index = stackIndex
                    };

                    ecb.AddComponent(ent, stack);

                    StackHeights[GridIndex(Grid.x, Grid.y)]++;
                }
                else
                {
                    ecb.DestroyEntity(ent);
                }
            }
        }