public override void OnConstruct() { base.OnConstruct(); _mainGo = itemDrag.CreateViewGameObject(null); if (_mainGo == null) { return; } FlagTrans.SetModel(_mainGo.transform); _mainGo.transform.parent = transform; _mainGo.transform.position = transform.position; _mainGo.transform.rotation = transform.rotation; _mainGo.transform.localScale = transform.localScale; ItemScript itemScript = _mainGo.GetComponentInChildren <ItemScript>(); if (null != itemScript) { itemScript.SetItemObject(itemDrag.itemObj); itemScript.InitNetlayer(mNetlayer); itemScript.id = id; itemScript.OnConstruct(); } }
void SetData() { if (mTowerEntity == null) { return; } ItemScript script = mTowerEntity.GetGameObject().GetComponent <ItemScript>(); if (script != null) { script.InitNetlayer(network); script.SetItemObject(itemDrag.itemObj); script.id = id; } }
protected override void OnActivate() { base.OnActivate(); if (itemLogic != null) { itemLogic.OnActivate(); } else { if (null != itemScript) { itemScript.InitNetlayer(network); itemScript.SetItemObject(itemDrag.itemObj); itemScript.id = id; itemScript.OnActivate(); } } }
public void Construct(DragItemLogicCreation dragLogic) { var creation = GetComponent <CreationController>(); creation.visible = true; switch (creation.category) { case EVCCategory.cgAircraft: { ItemScript itemScript = GetComponent <ItemScript>(); if (null != itemScript) { itemScript.SetItemObject(dragLogic.itemDrag.itemObj); itemScript.InitNetlayer(dragLogic.mNetlayer); itemScript.id = dragLogic.id; } break; } case EVCCategory.cgBoat: case EVCCategory.cgVehicle: case EVCCategory.cgRobot: case EVCCategory.cgAITurret: { ItemScript itemScript = GetComponent <ItemScript>(); if (null != itemScript) { itemScript.SetItemObject(dragLogic.itemDrag.itemObj); itemScript.InitNetlayer(dragLogic.mNetlayer); itemScript.id = dragLogic.id; } break; } } }