Exemplo n.º 1
0
    public void setAttributes(int spawnerInt, int index, Transform player)
    {
        playerTransform = player;
        var spawnerIntStr = spawnerInt.ToString();

        id             = index;
        width          = Int16.Parse(spawnerIntStr.Substring(0, 2));
        height         = Int16.Parse(spawnerIntStr.Substring(2, 2));
        centerOfObject = new Vector3(transform.position.x + (width / 2), transform.position.y + (height / 2), 0);
        var spawnerTypeList = SpawnerType.GetValues(typeof(SpawnerType)) as SpawnerType[];

        System.Random pseudoRandom = new System.Random((int)System.DateTime.Now.Ticks);
        type = spawnerTypeList[pseudoRandom.Next(0, spawnerTypeList.Length)];
        // type = SpawnerType.Walled;
        // Debug.Log(type);
        var numberOfWalls = Int16.Parse(spawnerIntStr.Substring(4, 1));

        for (var i = 0; i < numberOfWalls; i++)
        {
            createBoundaryWall(Int16.Parse(spawnerIntStr.Substring(5 + i, 1)));
        }
        setWallTriggers();
    }