Exemplo n.º 1
0
    public void Init()
    {
        FocusPoint = Vector2.zero;

        setupDataStructures();
        WorldMachine.WMachine.Init();
        WorldMachine.WMachine.generator.generateScenery();

        // TESTS
        //OBJ_SmallCrate crate = new OBJ_SmallCrate ();
        //crate.setPosition (new Vector2(3, 1), new Vector2(0, 0));

        //OBJ_RockItem rock = new OBJ_RockItem ();
        //rock.setPosition (new Vector2(2, 1), new Vector2(0, 0));


        //crate.setPosition (new Vector2(24, 24));

        Vector2 position = Vector2.zero;

        position = new Vector2(400, 400);
        if (!getTileFromWorldPoint(position).isBlocked())
        {
            active_player = new OBJ_Player("Player");
            active_player.setPosition(position);
        }

        for (int i = 0; i < 8; ++i)
        {
            position = new Vector2(400 + UnityEngine.Random.Range(-400, 400), 400 + UnityEngine.Random.Range(-400, 400));
            if (!getTileFromWorldPoint(position).isBlocked())
            {
                GCharacter charac = new GCharacter();
                charac.setPosition(position);
                charac.setBehaviour(new Behaviour_PaceRandomly());
            }
        }

        for (int i = 0; i < 30; ++i)
        {
            position = new Vector2(400 + UnityEngine.Random.Range(-400, 400), 400 + UnityEngine.Random.Range(-400, 400));
            if (!getTileFromWorldPoint(position).isBlocked())
            {
                OBJ_Rabbit bunny = new OBJ_Rabbit("a bunny");
                bunny.setPosition(position);
                bunny.setBehaviour(new Behaviour_PaceRandomly());
            }
        }
        // END TESTS
    }
Exemplo n.º 2
0
    public void Init()
    {
        FocusPoint = Vector2.zero;

        setupDataStructures ();
        WorldMachine.WMachine.Init ();
        WorldMachine.WMachine.generator.generateScenery ();

        // TESTS
        //OBJ_SmallCrate crate = new OBJ_SmallCrate ();
        //crate.setPosition (new Vector2(3, 1), new Vector2(0, 0));

        //OBJ_RockItem rock = new OBJ_RockItem ();
        //rock.setPosition (new Vector2(2, 1), new Vector2(0, 0));

        //crate.setPosition (new Vector2(24, 24));

        Vector2 position = Vector2.zero;

        position = new Vector2 (400, 400);
        if(!getTileFromWorldPoint(position).isBlocked()) {
            active_player = new OBJ_Player ("Player");
            active_player.setPosition (position);
        }

        for (int i = 0; i < 8; ++i) {
            position = new Vector2(400+UnityEngine.Random.Range(-400, 400), 400+UnityEngine.Random.Range(-400, 400));
                if(!getTileFromWorldPoint(position).isBlocked()) {
                GCharacter charac = new GCharacter ();
                charac.setPosition (position);
                charac.setBehaviour (new Behaviour_PaceRandomly());
            }
        }

        for (int i = 0; i < 30; ++i) {
            position = new Vector2(400+UnityEngine.Random.Range(-400, 400), 400+UnityEngine.Random.Range(-400, 400));
            if(!getTileFromWorldPoint(position).isBlocked()) {
                OBJ_Rabbit bunny = new OBJ_Rabbit ("a bunny");
                bunny.setPosition (position);
                bunny.setBehaviour (new Behaviour_PaceRandomly());
            }
        }
        // END TESTS
    }