void InitTest() { TextAsset EnemyJsonData = Resources.Load <TextAsset>("TextAssets/ShipDataSample"); ShipData EnemyData = ShipDataHelper.JsonToData(EnemyJsonData.text); string EnemyModelPath = "Ships/" + EnemyData.ModelName; GameObject EnemyShipModel = GameObject.Instantiate(AssetsLoader.LoadPrefab(EnemyModelPath), this.transform); Ship EnemyShip = EnemyShipModel.AddComponent <Ship>(); EnemyShip.Init(EnemyData); EnemyShip.ShipData.cannonNum = 1000; EnemyShipModel.AddComponent <EnemyShipController>(); //set tag EnemyShipModel.tag = "Enemy"; SetCollider(EnemyShipModel); Distance1 = DistanceToClose; Distance2 = DistanceToFlee; //ShowShipStats(EnemyShip); }
void Start() { _myShip = this.gameObject.GetComponent <Ship>(); GameObject pressFX = GameObject.Instantiate(AssetsLoader.LoadPrefab("PressEffect")); _pressEffect = pressFX.GetComponent <ParticleSystem>(); SetHPBar(); maxArmour = _myShip.OnGetArmour(); Debug.Log("!!!!!!!!!!!!!maxArmour =====" + maxArmour); }
public void InitScene(UserData player) { ShipData data = player.MyShips[0]; string modelPath = "Ships/" + data.ModelName; GameObject shipModel = GameObject.Instantiate(AssetsLoader.LoadPrefab(modelPath), this.transform); Ship playerShip = shipModel.AddComponent <Ship>(); playerShip.Init(data); shipModel.AddComponent <PlayerShipController>(); //set tag shipModel.tag = "Player"; //set collider SetCollider(shipModel); ShowShipStats(playerShip); }
void Start() { _main = GameObject.FindWithTag("GameMain").GetComponent <GameMain>(); foreach (IEnhanceable gear in _main.User.MyBag.MyShipGears) { GameObject go = GameObject.Instantiate(AssetsLoader.LoadPrefab("GearUI")); go.transform.SetParent(m_GearPock.transform); GearUIWrapper grid = go.GetComponent <GearUIWrapper>(); grid.InjectGearData(gear); grid.SetEnhBtn(OpenEnhPanel); ((ShipGear)gear).OnRemove += grid.RemoveThis; } foreach (IEnhancer enhcer in _main.User.MyBag.MyRunes) { GameObject go = GameObject.Instantiate(AssetsLoader.LoadPrefab("EnhUI")); go.transform.SetParent(m_RunePock.transform); EnhencerUIWrapper grid = go.GetComponent <EnhencerUIWrapper>(); grid.InjectGearData(enhcer); grid.SetEnhBtn(SelectEnhancer); OnSelectEnhcer += grid.Unselect; ((Rune)enhcer).OnRemove += grid.RemoveThis; } foreach (IEnhancer enhcer in _main.User.MyBag.MyJades) { GameObject go = GameObject.Instantiate(AssetsLoader.LoadPrefab("EnhUI")); go.transform.SetParent(m_JadePock.transform); EnhencerUIWrapper grid = go.GetComponent <EnhencerUIWrapper>(); grid.InjectGearData(enhcer); grid.SetEnhBtn(SelectEnhancer); OnSelectEnhcer += grid.Unselect; ((Jade)enhcer).OnRemove += grid.RemoveThis; } ItemIndexer.Init(); EnhanceIndexer.Init(); CloseEnhPanel(); }