Esempio n. 1
0
    /// <summary>
    /// 武器初始化.
    /// </summary>
    private void InitWeapon(GameObject weapon, int damage, int durable, GunType type, GameObject item)
    {
        GunControllerBase gcb = weapon.GetComponent <GunControllerBase>();

        gcb.Damage      = damage;
        gcb.Durable     = durable;
        gcb.M_GunType   = type;
        gcb.ToolBarItem = item;
    }
Esempio n. 2
0
    private void InitGun(GameObject gun, int damage, int durable, GunType gunType, GameObject icon)
    {
        GunControllerBase gcb = gun.GetComponent <GunControllerBase>();

        gcb.Id          = index++;
        gcb.Damage      = damage;
        gcb.Durable     = durable;
        gcb.WeapenType  = gunType;
        gcb.ToolBarIcon = icon;
    }
Esempio n. 3
0
    public void SetPlayerWeapen()
    {
        WeapenCfg weapenCfg = ResSvc.Instance.GetWeapenCfgData(battleProp.weapenCfgID);

        controller.gameObject.AddComponent <ObjectPool>();
        switch (weapenCfg.id)
        {
        case (int)WeapenType.Rifle:
            RifleView rifleView = controller.gameObject.AddComponent <RifleView>();
            gunControllerBase = controller.gameObject.AddComponent <Rifle>();
            gunControllerBase.M_GunViewBase = rifleView;
            break;

        case (int)WeapenType.Sniper:
            SniperView sniperView = controller.gameObject.AddComponent <SniperView>();
            gunControllerBase = controller.gameObject.AddComponent <Sniper>();
            gunControllerBase.M_GunViewBase = sniperView;
            break;
        }

        gunControllerBase.Init(weapenCfg);
    }