예제 #1
0
    protected void t(j A_0)
    {
        global::u.c("handleGetWorldBound");
        List <int>        list  = JsonParser.Deserialization <List <int> >(A_0);
        List <WorldBound> list2 = new List <WorldBound>();

        for (int i = 0; i < list.Count; i++)
        {
            int        id         = list[i];
            GameObject gameObject = GameObjectManager.INSTANCE.FindGameObjectGlobal(id);
            WorldBound worldBound = null;
            try
            {
                if (gameObject != null)
                {
                    worldBound = this.o.g(gameObject);
                }
                else
                {
                    worldBound         = new WorldBound();
                    worldBound.existed = false;
                }
            }
            catch (Exception ex)
            {
                global::u.a(ex.Message + " " + ex.StackTrace);
                worldBound         = new WorldBound();
                worldBound.existed = false;
            }
            worldBound.id = id;
            list2.Add(worldBound);
        }
        A_0.b = list2;
        global::o.a(A_0);
    }
예제 #2
0
    // Use this for initialization
    //assumes this has a sprite renderer and 4 facing directions named in order
    void Start()
    {
        #region References
        sceneBoundary = GameObject.Find("GameManager").GetComponent <WorldBound>();
        if (sceneBoundary == null)
        {
            Debug.LogError("WorldBound not found for levelManager in " + this + ".");
            Application.Quit();
        }

        // initialize projectile spawning
        if (Projectile == null)
        {
            Projectile = Resources.Load("Prefabs/Projectile") as GameObject;
        }
        if (Projectile == null)
        {
            Debug.LogError("Projectile not found for " + this + ".");
        }
        #endregion

        #region Get data from GlobalGameManager
        //increase rechargeDelay 4 * level
        RechargeDelay += (MenuBehavior.TheGameState.GetLastLevel() + 1) * 4;
        #endregion
    }
예제 #3
0
 void Awake()
 {
     sceneBoundary = GameObject.Find("GameManager").GetComponent <WorldBound>();
     if (sceneBoundary == null)
     {
         Debug.LogError("GameManager's WorldBound not found for " + this + ".");
         Application.Quit();
     }
 }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        #region References
        levelManager = GameObject.Find("GameManager").GetComponent <LevelBehavior>();
        if (levelManager == null)
        {
            Debug.LogError("GameManager not found for " + this + ".");
            Application.Quit();
        }

        sceneBoundary = GameObject.Find("GameManager").GetComponent <WorldBound>();
        if (sceneBoundary == null)
        {
            Debug.LogError("WorldBound not found for " + levelManager + " in " + this + ".");
            Application.Quit();
        }

        player = GameObject.Find("Hero");
        if (player == null)
        {
            Debug.LogError("Hero not found for " + this + ".");
        }
        else
        {
            playerController = player.GetComponent <PlayerControl>();
            if (playerController == null)
            {
                Debug.LogError("PlayerControl not found for " + player + ".");
            }
        }

        itemDrop = Resources.Load("Prefabs/PowerUp") as GameObject;
        if (itemDrop == null)
        {
            Debug.LogError("PowerUp not found for " + this + ".");
        }
        #endregion

        newDirection();
        newSpeed();
    }
예제 #5
0
    // Use this for initialization
    void Start()
    {
        #region Other references
        sceneBoundary = GameObject.Find("GameManager").GetComponent <WorldBound>();
        if (sceneBoundary == null)
        {
            Debug.LogError("WorldBound not found for levelManager in " + this + ".");
            Application.Quit();
        }

        scoreText = GameObject.Find("Score").GetComponent <Text>();
        if (scoreText == null)
        {
            Debug.LogError("Score not found.");
        }
        statusText = GameObject.Find("Status").GetComponent <Text>();
        if (statusText == null)
        {
            Debug.LogError("Status not found.");
        }

        tiler = GetComponent <Tiling>();
        if (tiler == null)
        {
            Debug.LogError("Tiler not found.");
        }

        #endregion

        #region Get data from GlobalGameManager
        totalScore   = MenuBehavior.TheGameState.GetTotalScore();
        level        = MenuBehavior.TheGameState.GetLastLevel() + 1;
        initialSpawn = MenuBehavior.TheGameState.GetLastEnemyCount() + level * initialSpawn;

        //non-level 1 changes
        if (level != 1)
        {
            Spawning = true;
            tiler.TileWorld("Prefabs/Tileset/Tile_Wood_", 10.0f, 10.0f, false, false, true, true, 2, 0);
        }
        else
        {
            tiler.TileWorld("Prefabs/Tileset/Tile_Wood_", 10.0f, 10.0f, false, false, true, true, 1, 0);
        }

        //increase spawn interval by 1s per level
        EnemySpawnInterval += level;
        #endregion

        #region Enemy spawning
        if (EnemyToSpawn == null)
        {
            EnemyToSpawn = Resources.Load("Prefabs/Enemy") as GameObject;
        }
        if (EnemyToSpawn == null)
        {
            Debug.LogError("Enemy not found.");
        }

        // first x enemies
        for (int i = 0; i < initialSpawn; i++)
        {
            SpawnAnEnemy(true);
        }
        #endregion
    }
예제 #6
0
    // Use this for initialization
    void Start()
    {
        #region Other references
        sceneBoundary = GameObject.Find("GameManager").GetComponent <WorldBound>();
        if (sceneBoundary == null)
        {
            Debug.LogError("WorldBound not found for levelManager in " + this + ".");
            Application.Quit();
        }

        scoreText = GameObject.Find("Score").GetComponent <Text>();
        if (scoreText == null)
        {
            Debug.LogError("Score not found.");
        }
        statusText = GameObject.Find("Status").GetComponent <Text>();
        if (statusText == null)
        {
            Debug.LogError("Status not found.");
        }

        tiler = GetComponent <Tiling>();
        if (tiler == null)
        {
            Debug.LogError("Tiler not found.");
        }

        #endregion

        #region Get data from GlobalGameManager
        totalScore   = MenuBehavior.TheGameState.GetTotalScore();
        level        = MenuBehavior.TheGameState.GetLastLevel() + 1;
        initialSpawn = MenuBehavior.TheGameState.GetLastEnemyCount() + level * initialSpawn;

        //non-level 1 changes
        if (level != 1)
        {
            Spawning = true;
            tiler.TileWorld("Prefabs/Tileset/Tile_Wood_", 10.0f, 10.0f, false, false, true, true, 2, 0);
        }
        else
        {
            tiler.TileWorld("Prefabs/Tileset/Tile_Wood_", 10.0f, 10.0f, false, false, true, true, 1, 0);

            //create a tutorial powerup
            GameObject itemDrop = Resources.Load("Prefabs/PowerUp") as GameObject;
            if (itemDrop == null)
            {
                Debug.LogError("PowerUp not found for " + this + ".");
            }
            else
            {
                GameObject e = Instantiate(itemDrop) as GameObject;
                e.transform.position = new Vector3(sceneBoundary.WorldCenter.x + 10, sceneBoundary.WorldCenter.y + 10, 0);
                TextMesh text = e.AddComponent <TextMesh>();
                text.text      = "This gives a burst of fireball charges!";
                text.fontSize  = 30;
                text.alignment = TextAlignment.Center;
            }
        }

        //increase spawn interval by 1s per level
        EnemySpawnInterval += level;
        #endregion

        #region Enemy spawning
        if (EnemyToSpawn == null)
        {
            EnemyToSpawn = Resources.Load("Prefabs/Enemy") as GameObject;
        }
        if (EnemyToSpawn == null)
        {
            Debug.LogError("Enemy not found.");
        }

        // first x enemies
        for (int i = 0; i < initialSpawn; i++)
        {
            SpawnAnEnemy(true);
        }
        #endregion
    }