public void init () { elementsHolder = transform.Find("ElementsHolder").GetComponent<ElementsHolder>(); iconsHolderRender = elementsHolder.GetComponent<SpriteRenderer>(); fightEffectPlayer = transform.Find("FightEffectPlayer").GetComponent<FightEffectPlayer>(); elementEffectPlayer = transform.Find("ElementEffectPlayer").GetComponent<ElementEffectPlayer>(); fightInterface = transform.Find("FightInterface").GetComponent<FightInterface>(); enemy = transform.Find("Enemy").GetComponent<Enemy>(); resultScreen = transform.Find("FightResultScreen").GetComponent<FightResultScreen>(); enemyDeadAnimator = transform.Find("EnemyDeadAnim").GetComponent<Animator>(); fightProcessor = GetComponent<FightProcessor>(); deadStone = enemyDeadAnimator.transform.Find("DeadStone"); enemyPos = enemy.transform.localPosition; potionBag = Vars.gameplay.getPotionBag(); elementsHolder.init(); enemy.init(); resultScreen.init(this, potionBag); fightInterface.init(); elementEffectPlayer.init(this, enemy); fightProcessor.init(this, elementsHolder, enemy, potionBag); elementsHolder.gameObject.SetActive(true); fightInterface.gameObject.SetActive(true); enemyDeadAnimator.gameObject.SetActive(false); gameObject.SetActive(false); }
public FightScreen init(ScanningScreen scanningScreen, StatusScreen statusScreen, ItemDescriptor itemDescriptor) { this.scanningScreen = scanningScreen; this.playerData = statusScreen.playerData; this.itemDescriptor = itemDescriptor; this.chambersHolder = statusScreen.cabin.chambersHolder; fightProcessor = GetComponent <FightProcessor>(); itemDescriptor.fightScreen = this; elementsHolder = transform.Find("Elements Holder").GetComponent <ElementsHolder> ().init(this);; iconsHolderRender = elementsHolder.GetComponent <SpriteRenderer>(); fightEffectPlayer = transform.Find("Fight Effect Player").GetComponent <FightEffectPlayer>().init(); elementEffectPlayer = transform.Find("ElementEffectPlayer").GetComponent <ElementEffectPlayer>(); fightInterface = transform.Find("Fight Interface").GetComponent <FightInterface>().init(this); enemy = transform.Find("Enemy").GetComponent <Enemy>(); resultScreen = transform.Find("Fight Result Screen").GetComponent <FightResultScreen>().init(this, statusScreen.cabin.chambersHolder, enemy); enemyDeadAnimator = transform.Find("EnemyDeadAnim").GetComponent <Animator>(); deadStone = enemyDeadAnimator.transform.Find("DeadStone"); enemyPos = enemy.transform.localPosition; // elementsHolder.init(); enemy.init(this); elementEffectPlayer.init(this, enemy); fightProcessor.init(this, elementsHolder, enemy); elementsHolder.gameObject.SetActive(true); enemyDeadAnimator.gameObject.SetActive(false); gameObject.SetActive(false); Transform actionsHolder = transform.Find("Actions Holder"); actionsHolder.Find("Delimiter").GetComponent <StrokeText>().init("default", 5); playerActionsText = actionsHolder.Find("Player Actions").GetComponent <StrokeText>().init("default", 5); enemyActionsText = actionsHolder.Find("Enemy Actions").GetComponent <StrokeText>().init("default", 5); actionsHolder.gameObject.SetActive(true); Transform supplyHolder = transform.Find("Supply Holder"); SupplySlot slot; for (int i = 0; i < supplyHolder.childCount; i++) { slot = supplyHolder.GetChild(i).GetComponent <SupplySlot>(); slot.init(); supplySlots.Add(slot); } supplyHolder.gameObject.SetActive(true); captureBtn = transform.Find("Capture Button").GetComponent <Button> ().init(); releaseBtn = transform.Find("Release Button").GetComponent <Button> ().init(); Player.fightScreen = this; return(this); }