예제 #1
0
 public void SwitchGameMode(int mode)
 {
     if (mode == 1)
     {
         mymouse3droomindicator.SetActive(false);
         fogofwarobject.SetActive(true);
         GUIDungeonMovement.GetComponent <Animator>().SetTrigger("PanelShow");
         GUIEditor.GetComponent <Animator>().SetTrigger("PanelHide");
         minimaplocal.MapInit(false);
         avatarobject_local.FogInit(false);
         avatarobject_local.FogUpdate((int)avatarobject_local.avataractualposition.x, (int)avatarobject_local.avataractualposition.y);
     }
     else if (mode == 10)
     {
         mymouse3droomindicator.SetActive(true);
         fogofwarobject.SetActive(false);
         GUIDungeonMovement.GetComponent <Animator>().SetTrigger("PanelHide");
         GUIEditor.GetComponent <Animator>().SetTrigger("PanelShow");
     }
     gamemode = mode;
 }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        int     i, j, k;
        Vector3 colpos;

        //------------------------DICES ROTATION-------------------------------
        DiceNumberRotation = new Vector3[6];

        for (i = 0; i < 6; i++)
        {
            DiceNumberRotation[i] = Vector3.zero;
        }
        DiceNumberRotation [1].x = 90;
        DiceNumberRotation [2].y = 90;
        DiceNumberRotation [2].x = 90;
        DiceNumberRotation [3].y = 270;
        DiceNumberRotation [4].x = 90;
        DiceNumberRotation [4].y = 180;
        DiceNumberRotation [5].y = 180;

        //----------------------------------------------------------------------

        dungeonmap.mapwalls = new maptile[mapsize, mapsize];
        mapwallobjects      = new maptileobj[mapsize, mapsize];


        avatarobject_local = GameObject.FindObjectOfType(typeof(avatarstatemachine)) as avatarstatemachine;

        character_definitions_local = GameObject.FindObjectOfType(typeof(character_definitions)) as character_definitions;

        map_piece_def[] myItems = FindObjectsOfType(typeof(map_piece_def)) as map_piece_def[];

        foreach (map_piece_def item in myItems) //delete scene data
        {
            Destroy(item.gameObject);
        }

        DestroyMap(true);

        minimaplocal = GameObject.FindObjectOfType(typeof(minimap)) as minimap;

        // systems initiation----------------------------------------------------------
        minimaplocal.MapInit(true);
        avatarobject_local.PathFindingInit();
        avatarobject_local.FogInit(true);
        GUIChestOpenedPopup.GetComponent <gui_chest_unlocked_popup>().InitGuiChestSystem();

        character_definitions_local.character_definitions_init(true);

        //mymouse3d = Instantiate(mouse3d, Vector3.zero, Quaternion.identity) as GameObject;
        //mymouse3d.transform.SetParent(mapcontainer.transform);
        mymouse3droomindicator = Instantiate(mouse3droomindicator, Vector3.zero, Quaternion.identity) as GameObject;
        mymouse3droomindicator.transform.SetParent(mapcontainer.transform);
        //Cursor.visible = false;
        //--------------------------------------------------------------------------------
        // main hero init-----------------------------------------------------

        gamemode = 1;
        if (gamemode == 1)
        {
            LoadMap();
        }

        avatarobject_local.SetCharacter(26, 23); //start position
        // battles -----------------------------------------------------
        character_definitions_local.AddBattle(27, 22, 0, 1);
        character_definitions_local.AddBattle(25, 25, 1, 1);

        //--------------------------------------------------------------
        clickrepeater = 0;
        leftclick     = false;
        rightclick    = false;
        altclick      = false;

        canscrollmanually   = true;
        avatarstatictime    = 0.4f;
        camerafadeouttime   = 0.3f;
        cameraspeed         = cameraspeedhi;
        scrollmultiplier    = 1;
        scrollpreviousframe = Vector3.zero;


        colpos                   = Vector3.zero;
        colpos.y                 = -floorZ;
        floorcollision           = new Plane(Vector3.up, colpos);
        tapcameracomponent       = tapcamera.GetComponent <Camera>();
        charactercameracomponent = charactercamera.GetComponent <Camera>();
        oldmousepos              = Vector3.zero;
        newmousepos              = Vector3.zero;

        SwitchGameMode(gamemode);
    }