コード例 #1
0
    void CreateEnemy()
    {
        BattleInfo.BattleModel battle_model = model_.BattleInfoList[0];
        foreach (EnemyModel enemy in battle_model.enemy_list)
        {
            GameObject enemy_prefab = (GameObject)Resources.Load(enemy.ModelPrefab);
            GameObject enemy_go     = Instantiate(enemy_prefab, enemy_trans_);

            //GameObject enemy_hpbar_prefab = Resources.Load("Prefab/Battle/UI/PlayerHpBar")as GameObject;
            GameObject enemy_hpbar_prefab = player_command_info_.PlayerHpBar;
            HPGauge    hp_gauge           = Instantiate(enemy_hpbar_prefab, enemy_ui_trans_).GetComponent <HPGauge>();
            hp_gauge.SetUp(enemy.Hp);

            GameObject enemy_damage_text_prehab = player_command_info_.PlayerDamageTextUi;
            DamageText damage_text = Instantiate(enemy_damage_text_prehab, enemy_ui_trans_).GetComponent <DamageText>();
            damage_text.gameObject.SetActive(false);
            enemy_effect_trans_ = enemy_go.transform.Find("RightHandEffector");

            //ここをリスト化した意味は? リスト化したのはデータの更新のため?
            Enemy enemy_data = enemy_go.GetComponent <Enemy>();
            enemy_data.GameObjectBattler = enemy_go;
            enemy_data.Hpgauge           = hp_gauge;
            enemy_data.MoveTransform     = enemy_trans_;
            enemy_data.EffectTransform   = enemy_effect_trans_;
            enemy_data.Setup(enemy);
            enemy_list_.Add(enemy_data);
            enemy_data.DamageText = damage_text;
        }
    }
コード例 #2
0
ファイル: BattleHero.cs プロジェクト: TimonYoon/Dev
    void OnDisable()
    {
        onDie    -= OnDie;
        onRevive -= OnRevive;
        onChangedCanResurrect             -= OnChangedCanResurrect;
        skeletonAnimation.state.Interrupt -= OnInterruptAnimation;

        isSuperArmor  = false;
        isBlockMove   = false;
        isBlockAttack = false;
        airborne      = false;
        notTargeting  = false;

        //if(objHPGauge)
        //    objHPGauge.SetActive(false);

        //hp게이지 도로 풀로 보냄
        if (objHPGauge)
        {
            HPGauge ui1 = objHPGauge.GetComponent <HPGauge>();
            ui1.Init(null);
            objHPGauge.SetActive(false);
            objHPGauge = null;
        }
    }
コード例 #3
0
 void Start()
 {
     objHPGauge        = (GameObject)Instantiate(preHPGauge, objCanvas.transform);
     hPGauge           = objHPGauge.GetComponent <HPGauge>();
     hPGauge.MaxHP     = maxHp;
     hpSlider          = gameObject.GetComponent <Slider>();
     hpSlider.maxValue = maxHp;
     hpSlider.value    = (float)nowHp / maxHp;
 }
コード例 #4
0
    public UISlider hpSlider;                           // 체력 슬라이더


    // 초기화
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;

            hpSlider = GetComponentInChildren <UISlider>();
        }
    }
コード例 #5
0
    void CreatePlayer()
    {
        // 所持キャラ一覧[キャラinfoのidの配列] //
        // パーティ[キャラinfoのidの配列]

        List <PlayerInfo> user_chara_list = new List <PlayerInfo>();

        BattleInfo.BattleModel battle_model = model_.BattleInfoList[0];
        foreach (PlayerModel player in player_info_.PlayerInfoList)
        {
            //Summon Playerprefab from PlayerInfo
            GameObject player_prefab = (GameObject)Resources.Load(player.ModelPrefab);
            GameObject player_go     = Instantiate(player_prefab, player_trans_);


            //Connect HpGauge and PlayerHp
            GameObject player_hpbar_prefab = player_command_info_.PlayerHpBar;
            HPGauge    hp_gauge            = Instantiate(player_hpbar_prefab, player_ui_trans_).GetComponent <HPGauge>();
            hp_gauge.SetUp(player.Hp);

            GameObject player_damage_text_prehab = player_command_info_.PlayerDamageTextUi;
            DamageText damage_text = Instantiate(player_damage_text_prehab, player_damage_ui_trans_).GetComponent <DamageText>();
            damage_text.gameObject.SetActive(false);
            //Instance effect_prehab
            //Heavyknight(Clone)/Crusader_Ctrl_Reference/Crusader_Ctrl_RightHandThumbEffector

            //player_effect_trans_ = player_go.transform.Find(player.EffectTransform);
            Transform player_effect_trans = player_go.transform.Find("Crusader_Ctrl_Reference/Crusader_Ctrl_RightHandMiddleEffector");
            player_effect_trans_ = GameObject.Find(player.EffectTransform).transform;


            GameObject effect_prehab = player.Effect;
            GameObject effect_go     = Instantiate(effect_prehab, player_effect_trans_);
            player_particle_ = effect_go.GetComponent <ParticleSystem>();



            //Connect user with PlayerInfo
            User user_data = player_go.GetComponent <User>();
            user_data.GameObjectBattler = player_go;
            user_data.Hpgauge           = hp_gauge;
            user_data.MoveTransform     = player_trans_;
            user_data.EffectParticle    = player_particle_;//New
            user_data.EffectTransform   = player_effect_trans_;
            user_data.Setup(player);
            user_list_.Add(user_data);
            user_data.DamageText = damage_text;
        }
    }
コード例 #6
0
ファイル: HPGauge.cs プロジェクト: 21garam/SW_Maestro
	void Awake()
	{
		instance = this;
		HPFiend.transform.localScale = new Vector3(1, 1, 1);
	}
コード例 #7
0
ファイル: BattleHero.cs プロジェクト: TimonYoon/Dev
    public override void SetBattleGroup(BattleGroup _battleGroup)
    {
        if (battleGroup)
        {
            battleGroup.blueTeamList.Remove(this);
            battleGroup.redTeamList.Remove(this);

            //기존 배틀그룹 관련 콜백 등록 해제
            battleGroup.onChangedBattlePhase -= OnChangedBattlePhase;

            if (buffController && !string.IsNullOrEmpty(battleGroup.dungeonID))
            {
                buffController.DetachBuff(GameDataManager.dungeonBaseDataDic[battleGroup.dungeonID].buffID);
            }
        }

        base.SetBattleGroup(_battleGroup);

        if (battleGroup)
        {
            //배틀그룹 관련 콜백 등록
            battleGroup.onChangedBattlePhase += OnChangedBattlePhase;
        }

        if (!battleGroup)
        {
            //Despawn();
            return;
        }


        //팀원 추가 될 때 콜백. 패시브 버프 처럼 등장하면서 부터 적용되어야 하는 것들을 위해 필요
        if (team == Team.Red)
        {
            battleGroup.redTeamList.onAdd += OnAddHeroToTeamList;
        }
        else if (team == Team.Blue)
        {
            battleGroup.blueTeamList.onAdd += OnAddHeroToTeamList;
        }

        //hp게이지 달아주기
        if (!objHPGauge)
        {
            objHPGauge = Battle.GetObjectInPool(Battle.hpGaugePrefab.name);
            if (!objHPGauge)
            {
                objHPGauge      = Instantiate(Battle.hpGaugePrefab, battleGroup.canvasUIBattleCharacter.transform);
                objHPGauge.name = Battle.hpGaugePrefab.name;
                Battle.AddObjectToPool(objHPGauge);
            }
        }

        objHPGauge.transform.SetParent(battleGroup.canvasUIBattleCharacter.transform);
        objHPGauge.SetActive(true);
        HPGauge ui = objHPGauge.GetComponent <HPGauge>();

        ui.Init(this);

        UpdateActiveState();
    }