public void DropWeapon() { Destroy(currentWeapon); weaponStats = null; currentWeapon = null; isHoldingWeapon = false; currentWeaponAttackTime = 0.33f; }
public override void Enter() { base.Enter(); weapon = character.weaponHolster.currentWeaponSelected.GetComponent <MeeleWeapon>(); currentTimeframe = currentStateTime = 0; maxStateTime = weapon.maxTime_atk1; changeState = false; Attack(); }
protected override void Start() { base.Start(); weaponItem = WeaponItem as MeeleWeapon; if (!weaponItem) { Destroy(gameObject); Debug.LogWarning("Incompatible Weapon Type!"); } }
private void UpdateMeele() { MeeleWeapon m = Pawn.Item?.MeeleWeapon; if (m != null) { m.LightAttack = Input.GetMouseButton(0); m.HeavyAttack = Input.GetMouseButton(1); } }
public void GetNewWeapon(GameObject collision) { if (!isHoldingWeapon) { currentWeapon = collision; weaponStats = collision.GetComponent <MeeleWeapon>(); collision.transform.parent = transform; isHoldingWeapon = true; weaponStats.isHeld = true; currentWeaponAttackTime = weaponStats.attackTime; currentWeapon.transform.position = new Vector3(0f, 0f, 0f); currentWeapon.transform.position = new Vector3(0f, 0f, 0f); if (player.localScale.x == -1f) { currentWeapon.transform.localScale = new Vector3(1f, -1f, 1f); } } }
private void UpdateMeele() { MeeleWeapon m = Pawn.Item?.MeeleWeapon; if (m == null) { return; } if (lastAttackCounter != m.AttackCounter) { chooseHeavy = Random.value <= HeavyAttackChance; lastAttackCounter = m.AttackCounter; } if (TargetEnemy == null) { m.LightAttack = false; m.HeavyAttack = false; } else { Vector3 targetPos = TargetEnemy.transform.position; Vector3 botPos = Pawn.transform.position; float sqrDst = (targetPos - botPos).sqrMagnitude; if (sqrDst <= AttackRange * AttackRange) { m.HeavyAttack = chooseHeavy; m.LightAttack = !chooseHeavy; } else { m.LightAttack = false; m.HeavyAttack = false; } } }