// Use this for initialization void Start() { attackDefendController = GameObject.Find("BattleControllers").GetComponent <AttackDefendController>(); itemController = GameObject.Find("BattleControllers").GetComponent <BattleItemController>(); abilityController = GameObject.Find("BattleControllers").GetComponent <BattleAbilityController>(); target = null; action = Action.Null; }
// Use this for initialization void Start() { currentUnit = gameObject.GetComponent <UnitStats>(); enemyParty = GameObject.Find("EnemyParty(Clone)").GetComponent <EnemyPartyController>(); flow = GameObject.Find("BattleControllers").GetComponent <BattleFlowController>(); ui = GameObject.Find("BattleControllers").GetComponent <BattleUIController>(); attackDefend = GameObject.Find("BattleControllers").GetComponent <AttackDefendController>(); mode = GameObject.Find("BattleControllers").GetComponent <BattleModeController>(); item = GameObject.Find("BattleControllers").GetComponent <BattleItemController>(); ability = GameObject.Find("BattleControllers").GetComponent <BattleAbilityController>(); }
// Use this for initialization void Start() { ui = GameObject.Find("BattleControllers").GetComponent <BattleUIController>(); target = GameObject.Find("BattleControllers").GetComponent <TargetHandler>(); party = GameObject.Find("PlayerParty").GetComponent <PartyController>(); controller = GameObject.Find("BattleControllers").GetComponent <BattleItemController>(); gameObject.transform.SetParent(invPanel.transform, false); StartCoroutine("WaitAndUpdateText"); Button theBtn = gameObject.GetComponent <Button>(); theBtn.onClick.AddListener(SetAction); action = Action.Item; }
private void OnCollisionEnter2D(Collision2D collision) { Sprite currentSprite = GetComponent <SpriteRenderer>().sprite; if (currentSprite == guardedSprite) { this.audio.PlayOneShot(this.block); return; } else { this.audio.PlayOneShot(this.hit); } BattleItemController item = collision.gameObject.GetComponent <BattleItemController>(); healthBar.HurtLove(item.GetDamage()); if (!healthBar.IsAlive() || healthBar.IsLoved()) { EndBattle(); } Destroy(collision.gameObject); }