/// <summary> /// 引数で渡された構造体のスプライトリストの中からどのスプライトを使用するか選択する /// </summary> /// <param name="selectedTextStruct"></param> /// <returns></returns> private AudioClip SelectVoice(CharaType selectedTextStruct, int randomNo) { var VoiceList = selectedTextStruct.voiceList; var selectedVoiceSprite = VoiceList[randomNo]; return(selectedVoiceSprite); }
/// <summary> /// 引数で渡された構造体のスプライトリストの中からどのスプライトを使用するか選択する /// </summary> /// <param name="selectedTextStruct"></param> /// <returns></returns> private Sprite SelectText(CharaType selectedTextStruct, int randomNo) { var TextList = selectedTextStruct.textList; var selectedTextSprite = TextList[randomNo]; return(selectedTextSprite); }
private int ChooseRundomIntUntilListCount(CharaType selectedTextStruct) { var TextList = selectedTextStruct.textList; int randomNo = Random.Range(0, TextList.Count); return(randomNo); }
public override void Initialize(int enumIndex) { _charaType = (CharaType)enumIndex; InitializeComponents(); UpdateWidgets(); }
public static Const.TileFlag ToTileFlag(this CharaType self) { switch (self) { case CharaType.Player: return(Const.TileFlag.Player); case CharaType.Enemy: return(Const.TileFlag.Enemy); default: Utility.Log.Error("CharaTypeからTileFlagへの変換ができません " + self); return(Const.TileFlag.None); } }
public static void LoadCharaData(TreeNode rootNode, CharaType type) { string folder = type.GetFolder(); string prefix = type.GetPrefix(); string charaDir = Path.Combine(Properties.Settings.Default.GameDirectory, String.Format("client/chara/{0}/", folder)); if (!Directory.Exists(charaDir)) { rootNode.Nodes.Add(new TreeNode("!error - directory does not exist")); return; } string cmnDir = Path.Combine(charaDir, "cmn"); string cmnFile = null; if (Directory.Exists(cmnDir)) { cmnFile = Path.Combine(cmnDir, "0001"); } var subdirs = Directory.GetDirectories(charaDir, prefix + "???", SearchOption.TopDirectoryOnly); foreach (string subdir in subdirs) { string dirName = Path.GetFileName(subdir); int modelId = 0; if (!Int32.TryParse(dirName.Substring(1), out modelId)) { continue; } CharaModelData charaModel = new CharaModelData(); charaModel.CharaType = type; charaModel.ModelId = modelId; charaModel.ModelPath = subdir; charaModel.ModelCommonFile = cmnFile; TreeNode node = new TreeNode(dirName); if (LoadModel(charaModel, node)) { rootNode.Nodes.Add(node); } } }
public void CreateNewPlayer() { CharaType charaType = CharaType.VirtualGuy; object obj; if (PhotonNetwork.player.CustomProperties.TryGetValue("CharaType", out obj)) { charaType = (CharaType)obj; } string player_prefab_name = "Prefabs/PlayerChara"; switch (charaType) { case CharaType.VirtualGuy: player_prefab_name = "Prefabs/PlayerChara Prototype"; break; case CharaType.Devil: player_prefab_name = "Prefabs/PlayerChara Prince2"; break; } Vector3 start_location = new Vector3(0, 0, 0); if (!PhotonNetwork.offlineMode) { PhotonNetwork.Instantiate(player_prefab_name, start_location, Quaternion.identity, 0); } else { var go = Instantiate(Resources.Load(player_prefab_name), start_location, Quaternion.identity) as GameObject; // Temp Code var playerController = go.GetComponent <PlayerController>(); playerController.enabled = true; playerController.BindMainCameraTarget(); playerController.Initialize(); } }
private static string GetPrefix(this CharaType type) { switch (type) { case CharaType.Monster: return("m"); case CharaType.BgObject: return("b"); case CharaType.Player: return("c"); case CharaType.Weapon: return("w"); default: throw new InvalidOperationException("Unknown CharaType"); } }
private static string GetFolder(this CharaType type) { switch (type) { case CharaType.Monster: return("mon"); case CharaType.BgObject: return("bgobj"); case CharaType.Player: return("pc"); case CharaType.Weapon: return("wep"); default: throw new InvalidOperationException("Unknown CharaType"); } }
public void LoadData() { BinaryFormatter bf = new BinaryFormatter(); FileStream fs = File.Open(Application.persistentDataPath + "/PlayerInfo/" + this.EntityName + ".dat", FileMode.Open); CharacterInfo ci = (CharacterInfo)bf.Deserialize(fs); fs.Close(); this.experience = ci.experience; this.level = ci.level; this.position = ci.position; this.CurrentHealth = ci.CurrentHealth; //Debug.Log(this.CurrentHealth); this.MaxHealth = ci.MaxHealth; this.CurrentMagicPoints = ci.CurrentMagicPoints; this.MaxMagicPoints = ci.MaxMagicPoints; this.PhysAttack = ci.PhysAttack; this.PhysDefense = ci.PhysDefense; this.MagAttack = ci.MagAttack; this.MagDefense = ci.MagDefense; this.Speed = ci.Speed; this.Chara = ci.Chara; //Effects = ci.Effects; }