Esempio n. 1
0
    private void InitWeaponInstances()
    {
        _weaponPlacementDictionary = new Dictionary <WeaponType, WeaponPlacement>();

        WeaponKnife knife = Instantiate(_weaponList.GetWeaponList().Knife);

        knife.transform.parent        = _rightHandSocket;
        knife.transform.localPosition = Vector3.zero;
        WeaponPlacement wk = new WeaponPlacement(_knifeSocket, knife);

        _weaponPlacementDictionary.Add(WeaponType.Knife, wk);

        WeaponPistol pistol = Instantiate(_weaponList.GetWeaponList().Pistol);

        pistol.transform.parent        = _pistolSocket;
        pistol.transform.localPosition = Vector3.zero;
        pistol.transform.rotation      = _pistolSocket.rotation;
        WeaponPlacement wp = new WeaponPlacement(_pistolSocket, pistol);

        _weaponPlacementDictionary.Add(WeaponType.Pistol, wp);

        WeaponRifle rifle = Instantiate(_weaponList.GetWeaponList().Rifle);

        rifle.transform.parent        = _rifleSocket;
        rifle.transform.localPosition = Vector3.zero;
        rifle.transform.localRotation = _pistolSocket.rotation;
        WeaponPlacement wr = new WeaponPlacement(_rifleSocket, rifle);

        _weaponPlacementDictionary.Add(WeaponType.Rifle, wr);
    }
Esempio n. 2
0
    void Start()
    {
        map = Global.Instance.mapManager;
        map.Init("maps/test_map");
        ui = GetComponent <UIManager>();



        Unit.OnEnteredNewNode      += UpdateVision;
        Unit.OnArrived             += UnitArrived;
        InputManager.OnTabPressed  += NextUnit;
        InputManager.OnActionStart += StartOrder;
        InputManager.OnActionEnd   += EndOrder;
        ui.InitUI();

        //canvas = GameObject.Find("ButtonCanvas");
        Global.Instance.SetMapBounds(new Vector2(0 - map.tileSize / 2, 0 - map.tileSize / 2), new Vector2(map.levelWidth * map.tileSize + map.tileSize / 2, map.levelHeight * map.tileSize + map.tileSize / 2));
        weapons = WeaponList.GetWeaponList("common/weapon_items");

        DeployArmies();

        UpdateVision();
        Global.Instance.cam.ScrollTo(player.soldierObjects[selectedSoldier].transform.position);
        SoldierSelected(0);
    }