コード例 #1
0
 /// <summary>
 /// スクリプトが開始した時の処理
 /// </summary>
 virtual protected void Start()
 {
     // 敵の元データが無いならば
     if (enemyResourceData == null)
     {
         // 敵の元データを読み込む
         enemyResourceData = Resources.Load <Entity_Sahagin>("Enemy/EnemyData/EnemyData");
     }
     // 敵の名前を設定する(継承先で設定する)
     SetName();
     // 敵のデータを読み込む
     LoadEnemyData();
     // ステータスを設定する
     if (!SetStatus() && PhotonNetwork.isMasterClient)
     {
         // エラー文を表示
         Debug.LogError(enemyName + "のステータスが設定されていません。");
         // ネットワークに接続されていたら
         if (PhotonNetwork.connected)
         {
             // ネットワーク上から削除する
             PhotonNetwork.Destroy(this.gameObject);
         }
         // ネットワークに接続されていなければ
         else
         {
             // ローカル上で削除する
             GameObject.Destroy(this.gameObject);
         }
         // 処理から抜ける
         return;
     }
     // マスタークライアントでなければ
     else if (!PhotonNetwork.isMasterClient)
     {
         // マスタークライアントにレベルと名前を送ってもらう
         RequireLevelAndNameForMaster();
     }
     // スクリプトコンポーネントのあるオブジェクトを格納する
     scripts = GameObject.FindGameObjectWithTag("Scripts");
     // アニメーションコンポーネントを取得する
     anim = gameObject.GetComponent <Animator>();
     // 通信同期のためのコンポーネントを取得する
     photonTransformView = gameObject.GetComponent <PhotonTransformView>();
     // 物理演算の為のコンポーネントを取得する
     rigBody = gameObject.GetComponent <Rigidbody>();
     // 攻撃用あたり判定コンポーネントをオフにする
     DisableAttackColliders();
     // マスタークライアントならば
     if (PhotonNetwork.isMasterClient)
     {
         // 移動速度を設定する
         moveValue.z = moveSpeed;
         // 通信同期のための移動速度を送る
         photonTransformView.SetSynchronizedValues(moveValue, 0f);
     }
     // ヘイトが一番高いプレイヤーを探す
     GetHaightHighestPlayer();
 }
コード例 #2
0
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        foreach (string asset in importedAssets)
        {
            if (!filePath.Equals(asset))
            {
                continue;
            }

            Entity_Sahagin data = (Entity_Sahagin)AssetDatabase.LoadAssetAtPath(exportPath, typeof(Entity_Sahagin));
            if (data == null)
            {
                data = ScriptableObject.CreateInstance <Entity_Sahagin> ();
                AssetDatabase.CreateAsset((ScriptableObject)data, exportPath);
                data.hideFlags = HideFlags.NotEditable;
            }

            data.sheets.Clear();
            using (FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read)) {
                IWorkbook book = new HSSFWorkbook(stream);

                foreach (string sheetName in sheetNames)
                {
                    ISheet sheet = book.GetSheet(sheetName);
                    if (sheet == null)
                    {
                        Debug.LogError("[QuestData] sheet not found:" + sheetName);
                        continue;
                    }

                    Entity_Sahagin.Sheet s = new Entity_Sahagin.Sheet();
                    s.name = sheetName;

                    for (int i = 1; i <= sheet.LastRowNum; i++)
                    {
                        IRow  row  = sheet.GetRow(i);
                        ICell cell = null;

                        Entity_Sahagin.Param p = new Entity_Sahagin.Param();

                        cell = row.GetCell(0); p.Name = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(1); p.HP = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(2); p.Attack = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(3); p.Defense = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(4); p.MagicAttack = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(5); p.MagicDefense = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(6); p.MoveSpeed = (float)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(7); p.TrackingSpeed = (float)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(8); p.ActionInterval = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(9); p.FieldOfView = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(10); p.ViewDistance = (float)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(11); p.ActionDistance = (float)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(12); p.HpRate = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(13); p.AttackRate = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(14); p.DefenseRate = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(15); p.MAtkRate = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(16); p.MDefRate = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(17); p.BaseExp = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(18); p.ExpRate = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(19); p.DamageRate = (float)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(20); p.Exp = (int)(cell == null ? 0 : cell.NumericCellValue);
                        s.list.Add(p);
                    }
                    data.sheets.Add(s);
                }
            }

            ScriptableObject obj = AssetDatabase.LoadAssetAtPath(exportPath, typeof(ScriptableObject)) as ScriptableObject;
            EditorUtility.SetDirty(obj);
        }
    }
コード例 #3
0
ファイル: EnemyData.cs プロジェクト: GochiMMO/MMO
 /// <summary>
 /// スクリプトが開始した時の処理
 /// </summary>
 protected virtual void Start()
 {
     // 敵の元データが無いならば
     if (enemyResourceData == null)
     {
         // 敵の元データを読み込む
         enemyResourceData = Resources.Load<Entity_Sahagin>("Enemy/EnemyData/EnemyData");
     }
     // 敵の名前を設定する(継承先で設定する)
     SetName();
     // 敵のデータを読み込む
     LoadEnemyData();
     // ステータスを設定する
     if (!SetStatus() && PhotonNetwork.isMasterClient)
     {
         // エラー文を表示
         Debug.LogError(enemyName + "のステータスが設定されていません。");
         // ネットワークに接続されていたら
         if (PhotonNetwork.connected)
         {
             // ネットワーク上から削除する
             PhotonNetwork.Destroy(this.gameObject);
         }
         // ネットワークに接続されていなければ
         else
         {
             // ローカル上で削除する
             GameObject.Destroy(this.gameObject);
         }
         // 処理から抜ける
         return;
     }
     // マスタークライアントでなければ
     else if (!PhotonNetwork.isMasterClient)
     {
         // マスタークライアントにレベルと名前を送ってもらう
         RequireLevelAndNameForMaster();
     }
     // スクリプトコンポーネントのあるオブジェクトを格納する
     scripts = GameObject.FindGameObjectWithTag("Scripts");
     // アニメーションコンポーネントを取得する
     anim = gameObject.GetComponent<Animator>();
     // 通信同期のためのコンポーネントを取得する
     photonTransformView = gameObject.GetComponent<PhotonTransformView>();
     // 物理演算の為のコンポーネントを取得する
     rigBody = gameObject.GetComponent<Rigidbody>();
     // 攻撃用あたり判定コンポーネントをオフにする
     DisableAttackColliders();
     // マスタークライアントならば
     if (PhotonNetwork.isMasterClient)
     {
         // 移動速度を設定する
         moveValue.z = moveSpeed;
         // 通信同期のための移動速度を送る
         photonTransformView.SetSynchronizedValues(moveValue, 0f);
     }
     // ヘイトが一番高いプレイヤーを探す
     GetHaightHighestPlayer();
 }