Example #1
0
    public void PathFindingInit()
    {
        int i, j, k;

        map_manager_local           = GameObject.FindObjectOfType(typeof(map_manager)) as map_manager;
        character_definitions_local = GameObject.FindObjectOfType(typeof(character_definitions)) as character_definitions;
        camera_lowfps_local         = GameObject.FindObjectOfType(typeof(camera_lowfps)) as camera_lowfps;
        GeneratePathfindingGraph();


        finalpath = new Vector2[maxsizepath];

        /*successfulpaths = new int[maxsizepath];
         *
         * paths = new path[maxsizepath];
         * for (i = 0; i < maxsizepath; i++)
         * {
         *  paths[i].singlepath = new Vector2[maxsizepath];
         *  paths[i].roomchecked = new bool[map_manager_local.mapsize, map_manager_local.mapsize];
         *
         *  for (j = 0; j < map_manager_local.mapsize; j++)
         *      for (k = 0; k < map_manager_local.mapsize; k++)
         *      {
         *          paths[i].roomchecked[j, k] = false;
         *      }
         * }*/
    }
Example #2
0
    public void character_definitions_init(bool firstinit)
    {
        if (firstinit)
        {
            def_enemy_list = new def_character[200]; //enemy template definitions

            SetupEnemyTemplates();

            def_hero_list = new def_character[10];

            SetupHeroTemplates();

            //actual enemies
            actual_enemy_list = new actual_character[200];

            //actual heroes
            actual_hero_list = new actual_character[5];

            map_manager_local = GameObject.FindObjectOfType(typeof(map_manager)) as map_manager;

            ActiveHeroIndex = 0;

            SetupNewHero(ActiveHeroIndex, 0);
        }


        EnemyBattlesCount = 0;
    }
    public void InitGuiChestSystem()
    {
        int i;

        camera_lowfps_local = GameObject.FindObjectOfType(typeof(camera_lowfps)) as camera_lowfps;
        map_manager_local   = GameObject.FindObjectOfType(typeof(map_manager)) as map_manager;
        avatarobject_local  = GameObject.FindObjectOfType(typeof(avatarstatemachine)) as avatarstatemachine;

        LootItemObjectField = new GameObject[6];
        DiceRewardField     = new GameObject[6];
        for (i = 0; i < 6; i++)
        {
            LootItemObjectField[i] = Instantiate(PrefabLootItemObject, Vector3.zero, Quaternion.identity) as GameObject;
            LootItemObjectField[i].transform.SetParent(LootLayoutObject.transform);
            LootItemObjectField[i].transform.localScale = PrefabLootItemObject.transform.localScale;
            //LootItemObjectField[i].SetActive (false);

            DiceRewardField[i] = Instantiate(map_manager_local.DiceObject, Vector3.zero, Quaternion.identity) as GameObject;
            DiceRewardField[i].transform.SetParent(LootItemObjectField[i].GetComponent <loot_item_def>().DiceSlot.transform);
            DiceRewardField[i].transform.localPosition = Vector3.zero;
            DiceRewardField[i].transform.localScale    = map_manager_local.DiceObject.transform.localScale;
            //DiceRewardField[i].transform.Rotate(map_manager_local.DiceNumberRotation[i].x,map_manager_local.DiceNumberRotation[i].y,map_manager_local.DiceNumberRotation[i].z);
            DiceRewardField[i].GetComponent <dice_machine>().dicelookatrotation.transform.Rotate(map_manager_local.DiceNumberRotation[i].x, map_manager_local.DiceNumberRotation[i].y, map_manager_local.DiceNumberRotation[i].z);
        }

        PanelToRollDicesObject = Instantiate(map_manager_local.PrefabPanelDicesToRollObject, Vector3.zero, Quaternion.identity) as GameObject;
        PanelToRollDicesObject.transform.SetParent(PanelDicesToRollPlaceholderObject.transform);
        PanelToRollDicesObject.transform.localRotation = Quaternion.identity;
        PanelToRollDicesObject.transform.localScale    = Vector3.one;
        PanelToRollDicesObject.transform.localPosition = Vector3.zero;
    }
    void Start()
    {
        this.mm = this.GetComponent <map_manager>();
        this.mm.load_map_as_current_map(this.md);

        GameObject go = new GameObject("player");

        this.p      = go.AddComponent <player>();
        this.p._map = this.mm.map_current;
    }
Example #5
0
    void Start()
    {
        x           = transform.position.x;
        y           = transform.position.z;
        speed_x     = 0.0f;
        speed_y     = 0.0f;
        state       = 0;
        state_timer = 0.0f;
        map         = GameObject.Find("tilemap_parent").GetComponent <map_manager>();

        image = transform.FindChild("image").gameObject.GetComponent <Renderer>().material;
        spritesheet_square_x        = 0;
        spritesheet_square_y        = 1;
        spritesheet_animation_timer = 0.0f;
    }
Example #6
0
    void Start()
    {
        int i;

        map_manager_local = GameObject.FindObjectOfType(typeof(map_manager)) as map_manager;

        DicesField = new DiceSlot[6];

        for (i = 0; i < 6; i++)
        {
            DicesField[i].Slot         = null;
            DicesField[i].Dice         = null;
            DicesField[i].dicesrolled  = false;
            DicesField[i].rollednumber = -1;
        }
    }
Example #7
0
    public void MapInit(bool firsttime)
    {
        int     i, j;
        Vector3 pos = Vector3.zero;

        if (firsttime)
        {
            avatarobject = Instantiate(mappath, Vector3.zero, Quaternion.identity) as GameObject;
            avatarobject.transform.SetParent(transform);
            avatarobject.transform.localScale    = Vector3.one;
            avatarobject.transform.localRotation = Quaternion.identity;

            map_manager_local = GameObject.FindObjectOfType(typeof(map_manager)) as map_manager;

            minimapdata = new GameObject[map_manager_local.mapsize, map_manager_local.mapsize];
        }

        for (i = 0; i < map_manager_local.mapsize; i++)
        {
            for (j = 0; j < map_manager_local.mapsize; j++)
            {
                if (minimapdata [i, j] != null)
                {
                    Destroy(minimapdata[i, j]);
                    //Debug.Log("Old minimap destroyed");
                }

                if (map_manager_local.dungeonmap.mapwalls[i, j].isroom)
                {
                    //Debug.Log("Found map_piece: " + map_manager_local.dungeonmap.maptiles[i,j].isroom);


                    minimapdata [i, j] = Instantiate(mappath, Vector3.zero, Quaternion.identity) as GameObject;


                    pos.x = i * 4;
                    pos.y = j * 4;
                    minimapdata[i, j].transform.SetParent(transform);
                    minimapdata[i, j].transform.localScale    = Vector3.one;
                    minimapdata[i, j].transform.localRotation = Quaternion.identity;
                    minimapdata[i, j].transform.localPosition = pos;
                    MapUpdate(i, j, 0);
                }
            }
        }
    }
Example #8
0
    //private GAME_STATE game_state;



    void Start()
    {
        /*
         * GameObject global_scripts = GameObject.Find("_GLOBAL_SCRIPTS");						// get the pointer to
         * if (!global_scripts) Application.LoadLevel("start_scene");							// the global game manager.
         * else game_state = GameObject.Find("_GLOBAL_SCRIPTS").GetComponent<GAME_STATE>();	//
         */
        camera = GameObject.Find("Main Camera").GetComponent <map_camera_script>();
        map    = GameObject.Find("tilemap_parent").GetComponent <map_manager>();
        map_ui = GameObject.Find("HUD Camera").GetComponent <map_ui_script>();

        //x = game_state.get_map_character_position().x;
        //y = game_state.get_map_character_position().y;
        x = 1f;
        y = -1.5f;
        camera.set_camera_target(x, y, true);

        image = transform.FindChild("character_image").gameObject.GetComponent <Renderer>().material;
        spritesheet_square_x        = 0;
        spritesheet_square_y        = 0;
        spritesheet_animation_timer = 0.0f;
    }
Example #9
0
    void Start()
    {
        x = transform.position.x;
        y = transform.position.z;
        speed_x = 0.0f;
        speed_y = 0.0f;
        state = 0;
        state_timer = 0.0f;
        map = GameObject.Find("tilemap_parent").GetComponent<map_manager>();

        image = transform.FindChild("image").gameObject.GetComponent<Renderer>().material;
        spritesheet_square_x = 0;
        spritesheet_square_y = 1;
        spritesheet_animation_timer = 0.0f;
    }
Example #10
0
 // Use this for initialization
 void Start()
 {
     map_manager_local   = GameObject.FindObjectOfType(typeof(map_manager)) as map_manager;
     avatarobject_local  = GameObject.FindObjectOfType(typeof(avatarstatemachine)) as avatarstatemachine;
     camera_lowfps_local = GameObject.FindObjectOfType(typeof(camera_lowfps)) as camera_lowfps;
 }