private void OnTriggerEnter2D(Collider2D col) { AttackBox box = col.GetComponent <AttackBox>(); if (box != null && !isAttackEffective) { if (isBlocking && blockTime < perfectBlockDuration) { OnPerfectBlockAttack(); } else if (isBlocking) { OnBlockAttack(); } else { ReceiveDamage(col.transform.position); } } if (col.gameObject.CompareTag("Hazard")) { Die(); } }
private void ChainAttack() //連続モーションの実行はここ(コンボは違う { currentAttack?.ToolsOff(); currentAttack = currentAttack.NextAttack(); currentAttack.ToolsOn(); attackAnimControll.ChangeAnim(currentAttack); InAttack = true; }
public void Attack() { Debug.Log("Player Attacking"); AttackBox attack = Instantiate(attackPrefab, transform.position + transform.forward * -1, Quaternion.identity).GetComponent <AttackBox>(); attack.transform.parent = this.transform; attack.SetInfo(new MonsterAttackInfo(null, ATTACK_AMOUNT)); }
public void AttackEnd() { InAttack = false; currentRoot = null; keyBuffer = null; AttackEnable = false; currentAttack = null; attackAnimControll.CashClear(); }
private void Start() { PlayerRef = GameObject.Find("Player").GetComponent <Player>(); anim = PlayerRef.GetComponentInChildren <Animator>(); FirePoint = GameObject.Find("FirePoint"); Transform AttackBoxTrans = this.gameObject.transform.GetChild(0); AttackBoxGO = AttackBoxTrans.gameObject; AttackBoxScript = AttackBoxGO.gameObject.GetComponent <AttackBox>(); PC = GameObject.Find("PlayerBase").GetComponent <PlayerController>(); PR = GameObject.Find("PlayerBase").GetComponent <PlayerRotate>(); }
/// <summary> /// 'Hit' a monster in combat /// </summary> /// <param name="monster">Monster to hit.</param> public void HitMonster() { if (Vector3.Distance(transform.position, enemyTarget.position) <= ATTACK_DISTANCE) // only apply the attack if they're close enough { Monster monster = enemyTarget.GetComponent <Monster>(); // send damage data to 'monster' //monster.TakeDamage(new MonsterAttackInfo(this, 10)); // spawn attack box instead of directly sending damage AttackBox attack = Instantiate(attackPrefab, transform.position + transform.forward * (ATTACK_DISTANCE / 2), Quaternion.identity).GetComponent <AttackBox>(); //attack.SetAttacker(this); attack.SetInfo(new MonsterAttackInfo(this, 10)); } }
public AudioSource boomSound; //Sound effect // Start is called before the first frame update public void setUp(float knockback) { AttackBox bombInfo = transform.parent.GetComponent <AttackBox>(); currentMove = bombInfo.currentMove; enemyTag = bombInfo.enemyTag; //enemyAttackTag = bombInfo.enemyAttackTag; priority = bombInfo.priority + 1; knockbackVal = 2 * knockback; timer = 0.0f; active = false; }
public GameObject GetAttackingBox(AttackBox attackingBox) { if (attackingBox == AttackBox.PUNCH_BOX) { return(l_punchBox); } if (attackingBox == AttackBox.KICK_BOX) { return(l_kickBox); } // FUTURE PROGRESS //else if (attackingBox == AttackBox.MELEE_WEAPON) //{ // return animationProgress.holdingWeapon.triggerDetector.gameObject; //} return(null); }
public override void Start() { //StartCoroutine(EnemyAttack()); base.Start(); if (m_DataList) { m_Data = m_DataList.GetDataFromType(m_Type); } m_AttackBox = GetComponentInChildren <AttackBox>(true); m_CurrentSpeed = m_Data.Speed; m_EnemyManager.RegisterEnemy(this); if (attack1 == null) { attack1 = Instantiate(m_FXAttack1); } visualFeedback = GetComponent <VisualFeedback>(); }
private void Attack(PlayerKeyCode player_key_code) { AttackBox result = null; var info = new AttackInputInfo(new List <PlayerKeyCode>() { player_key_code }, CurrentState, CurrentPhase); if (keyBuffer != null) { var duo_info = info; duo_info.keyCodes = new List <PlayerKeyCode>(info.keyCodes) { (PlayerKeyCode)keyBuffer }; result = FindAttack(duo_info); if (result != null) { foreach (var item in playerCancelProcesses.Where(i => !(i is AttackControll))) { item.Cancel(); } } } if (result == null) { if (currentAttack == null) { result = FindAttack(info); var str = result + ","; } else if (FindAttack(info) == currentRoot && currentAttack.HasNext && currentAttack.NextAttack().attackInputInfo.commandType != CommandType.Chain) { result = currentAttack.NextAttack(); } } if (currentAttack != null && currentAttack == result) { return; } if (result == null) { return; //ここでNullなら攻撃がないので非実行 } currentAttack?.ToolsCancel(); currentAttack = result; Observable .Timer(TimeSpan.FromSeconds(result.delayTimeForTools)) .Where(n => this.InAttack) .Subscribe(n => { if (result == currentAttack) { currentAttack.ToolsOn(); AttackEnable = true; } }); if (currentRoot == null) { currentRoot = result; } attackAnimControll.ChangeAnim(currentAttack); InAttack = true; }
void Awake() { S = this; AtkArray = new Attack[4]; }