// 显示信息
    public void ShowInfo(ICamp Camp)
    {
        //Debug.Log("显示兵营信息");
        Show();
        m_Camp = Camp;

        // 名称
        m_CampNameTxt.text = m_Camp.GetName();
        // 训练花费
        m_TrainCostText.text = string.Format("AP:{0}", m_Camp.GetTrainCost());
        // 训练中信息
        ShowOnTrainInfo();
        // Icon
        IAssetFactory Factory = PBDFactory.GetAssetFactory();

        m_CampImage.sprite = Factory.LoadSprite(m_Camp.GetIconSpriteName());

        // 升級功能
        if (m_Camp.GetLevel() <= 0)
        {
            EnableLevelInfo(false);
        }
        else
        {
            EnableLevelInfo(true);
            m_CampLvTxt.text = string.Format("等级:" + m_Camp.GetLevel());
            ShowWeaponLv();            // 显示武器等级
        }
    }
    // 显示信息
    public void ShowInfo(ISoldier Soldier)
    {
        //Debug.Log("显示Soldier信息");
        m_Soldier = Soldier;
        if (m_Soldier == null || m_Soldier.IsKilled())
        {
            Hide();
            return;
        }
        Show();

        // 显示Soldier信息
        // Icon
        IAssetFactory Factory = PBDFactory.GetAssetFactory();

        m_Icon.sprite = Factory.LoadSprite(m_Soldier.GetIconSpriteName());
        // 名称
        m_NameTxt.text = m_Soldier.GetName();
        // 等级
        m_LvTxt.text = string.Format("等级:{0}", m_Soldier.GetSoldierValue().GetSoldierLv());
        // Atk
        m_AtkTxt.text = string.Format("攻击力:{0}", m_Soldier.GetWeapon().GetAtkValue());
        // Atk距离
        m_AtkRangeTxt.text = string.Format("攻击距离:{0}", m_Soldier.GetWeapon().GetAtkRange());
        // Speed
        m_SpeedTxt.text = string.Format("移动速度:{0}", m_Soldier.GetSoldierValue().GetMoveSpeed());;

        // 更新HP信息
        RefreshHPInfo();
    }
    // 顯示資訊
    public void ShowInfo(ISoldier Soldier)
    {
        //Debug.Log("顯示Soldier資訊");
        m_Soldier = Soldier;
        if (m_Soldier == null || m_Soldier.IsKilled())
        {
            Hide();
            return;
        }
        Show();

        // 顯示Soldier資訊
        // Icon
        IAssetFactory Factory = PBDFactory.GetAssetFactory();

        m_Icon.sprite = Factory.LoadSprite(m_Soldier.GetIconSpriteName());
        // 名稱
        m_NameTxt.text = m_Soldier.GetName();
        // 等級
        m_LvTxt.text = string.Format("等級:{0}", m_Soldier.GetSoldierValue().GetSoldierLv());
        // Atk
        m_AtkTxt.text = string.Format("攻擊力:{0}", m_Soldier.GetWeapon().GetAtkValue());
        // Atk距離
        m_AtkRangeTxt.text = string.Format("攻擊距離:{0}", m_Soldier.GetWeapon().GetAtkRange());
        // Speed
        m_SpeedTxt.text = string.Format("移動速度:{0}", m_Soldier.GetSoldierValue().GetMoveSpeed());;

        // 更新HP資訊
        RefreshHPInfo();
    }
Beispiel #4
0
    // 载入Asset中的角色模型
    public override void LoadAsset(int GameObjectID)
    {
        IAssetFactory AssetFactory      = PBDFactory.GetAssetFactory();
        GameObject    SoldierGameObject = AssetFactory.LoadSoldier(m_BuildParam.NewCharacter.GetAssetName());

        SoldierGameObject.transform.position = m_BuildParam.SpawnPosition;
        SoldierGameObject.gameObject.name    = string.Format("Soldier[{0}]", GameObjectID);
        m_BuildParam.NewCharacter.SetGameObject(SoldierGameObject);
    }
Beispiel #5
0
    // 播放音效
    public void PlaySound(string ClipName)
    {
        //  取得音效
        IAssetFactory Factory = PBDFactory.GetAssetFactory();
        AudioClip     theClip = Factory.LoadAudioClip(ClipName);

        if (theClip == null)
        {
            return;
        }
        m_Audio.clip = theClip;
        m_Audio.Play();
    }
Beispiel #6
0
    // 播放特效
    public void PlayEffect(string EffectName)
    {
        //  取得特效
        IAssetFactory Factory   = PBDFactory.GetAssetFactory();
        GameObject    EffectObj = Factory.LoadEffect(EffectName);

        if (EffectObj == null)
        {
            return;
        }

        // 加入
        UnityTool.Attach(m_GameObject, EffectObj, Vector3.zero);
    }
Beispiel #7
0
    // 建立武器
    public override IWeapon CreateWeapon(ENUM_Weapon emWeapon)
    {
        IWeapon pWeapon   = null;
        string  AssetName = "";         // Unity模型名称
        int     AttrID    = 0;          // 武器的能力值

        // 依武器
        switch (emWeapon)
        {
        case ENUM_Weapon.Gun:
            pWeapon   = new WeaponGun();
            AssetName = "WeaponGun";
            AttrID    = 1;
            break;

        case ENUM_Weapon.Rifle:
            pWeapon   = new WeaponRifle();
            AssetName = "WeaponRifle";
            AttrID    = 2;
            break;

        case ENUM_Weapon.Rocket:
            pWeapon   = new WeaponRocket();
            AssetName = "WeaponRocket";
            AttrID    = 3;
            break;

        default:
            Debug.LogWarning("CreateWeapon:无法建立[" + emWeapon + "]");
            return(null);
        }

        // 产生Asset
        IAssetFactory AssetFactory    = PBDFactory.GetAssetFactory();
        GameObject    WeaponGameObjet = AssetFactory.LoadWeapon(AssetName);

        pWeapon.SetGameObject(WeaponGameObjet);

        // 取得武器的威力
        IAttrFactory theAttrFactory = PBDFactory.GetAttrFactory();
        WeaponAttr   theWeaponAttr  = theAttrFactory.GetWeaponAttr(AttrID);

        // 设定武器的威力
        pWeapon.SetWeaponAttr(theWeaponAttr);

        return(pWeapon);
    }
    // 顯示音效
    protected void ShowSoundEffect(string ClipName)
    {
        if (m_Audio == null)
        {
            return;
        }

        //  取得音效
        IAssetFactory Factory = PBDFactory.GetAssetFactory();
        AudioClip     theClip = Factory.LoadAudioClip(ClipName);

        if (theClip == null)
        {
            return;
        }
        m_Audio.clip = theClip;
        m_Audio.Play();
    }