yyl
昨天 5d3366f2e0f687995eb7ad2107c4379fe7acd4e8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 
using System.Collections.Generic;
using System;
using UnityEngine;
 
public class BattleObjectFactory
{
    //  本意是要在这里做池的内容的 但是想了一下 利用效率有点差 最多做一下红色方的缓存 蓝色方的即时用 即时删除 或者缓存上一次战斗的就行
    private static int AutoIncrementID = 100000;
 
    public static BattleObject CreateBattleObject(BattleField _battleField, List<GameObject> posNodeList, TeamHero teamHero, BattleCamp _Camp)
    {
        HeroSkinConfig skinCfg = teamHero.heroInfo.skinConfig;
        GameObject battleGO = ResManager.Instance.LoadAsset<GameObject>("Hero/SpineRes", "Hero_001"/*skinCfg.SpineRes*/);
        GameObject goParent = posNodeList[teamHero.heroIndex];
        BattleObject battleObject = new BattleObject(_battleField);
        battleObject.BattleObjectId = AutoIncrementID++;
        battleGO.name = battleObject.BattleObjectId.ToString();
        battleObject.Init(GameObject.Instantiate(battleGO, goParent.transform), teamHero, _Camp);
        return battleObject;
    }
 
    public static void DestroyBattleObject(int key, BattleObject battleObj)
    {
        battleObj.Destroy();
        battleObj = null;
    }
}