public void OnButtonPress(int nIndex) { CharactorCtrl charCtrl = m_listCharacterPrefabList[nIndex]; charCtrl.SetStat(m_listCharacterPrefabList[nIndex].gameObject.name); if (gameMgr.Gold >= charCtrl.price) { gameMgr.Gold -= charCtrl.price; SpawnMoster(nIndex, true); } }
public override void SpawnMoster(int nIndex, bool bFlagMyTeam) { SOFile_MonsterSpawn p_SOFile_MonsterSpawn = m_listSOFile_MonsterSpawn[nIndex]; GameObject p_SpawnMonster = Instantiate(p_SOFile_MonsterSpawn.characterCtrl.gameObject); Vector3 p_VecCharScale = p_SpawnMonster.transform.localScale; p_VecCharScale.x *= -1; p_SpawnMonster.transform.localScale = p_VecCharScale; p_SpawnMonster.tag = bFlagMyTeam ? "Player" : "Enemy"; p_SpawnMonster.transform.position = spawnPos.position; CharactorCtrl nCharacterCtrl = p_SpawnMonster.GetComponent <CharactorCtrl>(); if (nCharacterCtrl != null) { nCharacterCtrl.SetupSpawnBase(this, m_SpawnBaseOtherSide); nCharacterCtrl.SetStat(p_SOFile_MonsterSpawn.characterCtrl.gameObject.name); m_listCharCtrl_Use.Add(nCharacterCtrl); } }
public override void SpawnMoster(int nIndex, bool bFlagMyTeam) { GameObject p_SpawnMonster = Instantiate(m_listCharacterPrefabList[nIndex].gameObject); Vector3 p_VecCharScale = p_SpawnMonster.transform.localScale; if (bFlagMyTeam == false) { p_VecCharScale.x *= -1; p_SpawnMonster.transform.localScale = p_VecCharScale; } p_SpawnMonster.tag = bFlagMyTeam ? "Player" : "Enemy"; p_SpawnMonster.transform.position = spawnPos.position; CharactorCtrl nCharacterCtrl = p_SpawnMonster.GetComponent <CharactorCtrl>(); if (nCharacterCtrl != null) { nCharacterCtrl.SetupSpawnBase(this, m_SpawnBaseOtherSide); nCharacterCtrl.SetStat(m_listCharacterPrefabList[nIndex].gameObject.name); m_listCharCtrl_Use.Add(nCharacterCtrl); } StartCoroutine(CheckSpawnCoolTime(nIndex, nCharacterCtrl.spawnCoolTime)); }