private void OnTriggerEnter2D(Collider2D collision) { // not interact with tackle layer if (!collision.gameObject.layer.Equals(tackleLayerNum)) { return; } // no tackle settings attached if (collision.gameObject.GetComponent <TackleInfo>() == null) { return; } // the tackle has been picked up already if (collision.gameObject.GetComponent <TackleInfo>().isPicked) { return; } TackleInfo tackle_Triggered = collision.gameObject.GetComponent <TackleInfo>(); tackle_Triggered = collision.gameObject.GetComponent <TackleInfo>(); tackle_Triggered.GetPickedUp(); }
private void OnTacklePickedUp(TackleInfo tackle) { Debug.Log(string.Format("onTacklePickedUp: {0}", tackleContent)); // disapper this.isPicked = true; this.gameObject.SetActive(false); // add to backpack }
public void playerTackleTo(TackleInfo pTackleInfo) { m_tackleInfo = pTackleInfo; if (m_tackleInfo.m_isDribble) { tackleDribbleStart(); } else { tackleNoDribbleStart(); } }
public void OnTacklePickedUp(TackleInfo tackle) { // pick up skill tackle if (tackle.tackleProperty == TackleProperty.SKILL) { SkillSlot slot_Skill = (SkillSlot)InventoryManager.GetInstance.GetAvailableSlot(); slot_Skill.SetSlotImage(tackle.tackleIcon); slot_Skill.SlotTackleType = tackle.tackleContent; if (slot_Skill.SlotTackleType == TackleContent.SWORD) { slot_Skill.SkillCoolDownDuration = _motor.waveCooldown; _motor._isWaveEnabled = true; } else if (slot_Skill.SlotTackleType == TackleContent.DAGGER) { slot_Skill.SkillCoolDownDuration = _motor.throwCooldown; _motor._isThrowEnabled = true; } else if (slot_Skill.SlotTackleType == TackleContent.DASH_SHOE) { slot_Skill.SkillCoolDownDuration = _motor.dashCooldown; _motor._isDashEnabled = true; } slot_Skill.FillSlot(); if (tackle.tackleContent == TackleContent.DAGGER) { if (PickUpDaggerSkill != null) { PickUpDaggerSkill(); } } Debug.Log(string.Format("Put tackle: {0} into slot: {1}", tackle.tackleContent, slot_Skill.slotIndex)); } // pick up bonus tackle else if (tackle.tackleProperty == TackleProperty.BONUS) { if (tackle.tackleContent == TackleContent.HEALTH_POINT) { GetComponent <Damageable>().GainHealth(1); } } }
private void currentPlayerMovedToTile(Player pPlayer) { Player tacklePlayer; if (isPlayerTackled(pPlayer, out tacklePlayer)) { ApplicationFactory.instance.m_messageBus.dispatchTackleBattleStart(); FX02 fx = ApplicationFactory.instance.m_fxManager.createFX02(tacklePlayer.transform.position); fx.init(); fx.e_end += startPlayerTackleTo; bool isDribble = UnityEngine.Random.RandomRange(0.0f, 1.0f) > 0.5f; m_tackleInfo = new TackleInfo(); m_tackleInfo.m_isDribble = isDribble; m_tackleInfo.m_jumpPlayer = pPlayer; m_tackleInfo.m_tacklePlayer = tacklePlayer; m_tackleInfo.m_tackleToIndex = pPlayer.Index; if (isDribble) { if (pPlayer.isMoveEnded) { m_tackleInfo.m_jumpToIndex = tacklePlayer.Index; } else { m_tackleInfo.m_jumpToIndex = pPlayer.nextMoveTileIndex; } } else { m_tackleInfo.m_jumpToIndex = tacklePlayer.Index; } } else { pPlayer.moveToNextSquare(); } }
private void startTackle(Vector2 pIndex) { m_cursor.e_end -= startTackle; m_cursor.e_cancel -= cancelTackle; Player playerToTackle = m_board.getPlayerAtIndex(pIndex); bool isDribble = UnityEngine.Random.RandomRange(0.0f, 1.0f) > 0.5f; TackleInfo tackleInfo = new TackleInfo(); tackleInfo.m_isDribble = isDribble; tackleInfo.m_jumpPlayer = playerToTackle; tackleInfo.m_tacklePlayer = m_currentPlayer; tackleInfo.m_jumpToIndex = m_currentPlayer.Index; tackleInfo.m_tackleToIndex = pIndex; m_game.playerTackleTo(tackleInfo); m_game.tackleEnded += playerTackleEnded; m_board.clearTileRadius(); m_cursor.setActive(false); }