private bool Move() { if (!Physics.Raycast(GetMouseRay(), out var info)) { return(false); } if (!Input.GetMouseButton(0)) { return(true); } _scheduler.StartAction(_mover); _mover.StartMoving(info.point, 1f); return(true); }
public void Attack(ActionScheduler scheduler, PlayerCursor cursor) { float timePerAttack = 1 / stats.GetStat(Stat.AttackSpeed); if (Time.time < lastAttackTime + timePerAttack) { return; } if (!scheduler.StartAction(this, false)) { return; } if (!stamina.UseStamina(currentWeapon.baseItem.staminaUse)) { return; } lastAttackTime = Time.time; animator.ResetTrigger("cancelAttack"); animator.SetTrigger("attack"); if (currentWeapon) { currentWeapon.hitArea.AdjustDirection(cursor.Position - transform.position); } currentWeapon.DamageAreaLockState(true); }
public void Attack(GameObject combatTarget) { target = combatTarget.transform; _scheduler.StartAction(this); print("I'm attacking: " + combatTarget.name); }
public override bool Use(GameObject user) { Mana mana = user.GetComponent <Mana>(); if (mana.GetManaPoints() < manaCost) { return(false); } CooldownStore cooldownStore = user.GetComponent <CooldownStore>(); if (cooldownStore.GetTimeRemaining(this) > 0) { return(false); } AbilityData data = new AbilityData(user); ActionScheduler actionScheduler = user.GetComponent <ActionScheduler>(); actionScheduler.StartAction(data); targetingStrategy.StartTargeting(data, () => TargetAcquired(data)); return(true); }
public Mover StartMovement(Vector3 destination, float speedFraction) { m_ActionScheduler.StartAction(this); MoveTo(destination, speedFraction); return(this); }
public void StartMoveAction(Vector3 destination) { if (!scheduler.StartAction(this, false)) { return; } MoveTo(destination); }
public void SetInteractionTarget(IInteraction target) { if (!scheduler.StartAction(this, false)) { return; } interactionTarget = target; }
//distinction between action start and just calling move to. public void StartMoveAction(Vector3 destination) { _actionScheduler.StartAction(this); //deselecting whatever target we have and then moving MoveTo(destination); }
//Tells scheduler to start movement public void StartMoveAction(Vector3 destination) { //Schedule action m_ActionScheduler.StartAction(this); //Move to destination MoveTo(destination); }
public void Attack(GameObject combatTarget) { if (combatTarget == null) { return; } _actionScheduler.StartAction(this); this._target = combatTarget.GetComponent <Health>(); }
///////////////////////////// PUBLIC METHODS //////////////////////////////////////////// /// <summary> /// Attacks the target /// </summary> /// <param name="combatTarget"></param> public void Attack(GameObject combatTarget) { //Schedule attack action m_ActionScheduler.StartAction(this); //Set combat target m_Target = combatTarget.GetComponent <Health>(); //Debug.Log("Attacking: " + combatTarget.name); }
public void Attack(GameObject combatTarget) { target = combatTarget.GetComponent <Animal>(); if (target) { actionScheduler.StartAction(this); attackQueued = true; } }
public void StartMoveAction(Vector3 destination) { if (MouseData.tempItemBeingDragged != null) { return; } _actionScheduler.StartAction(this); MoveTo(destination); }
public void Attack(GameObject combatTarget) { _scheduler.StartAction(this); _target = combatTarget.GetComponent <Health>(); if (_target) { _mover.MoveToLocation(_target.transform.position); } }
public void CastAbility(KeyCode key, LayerMask collisionLayer) { AbilityCooldownDisplay abilitySlot = abilitySlots[key]; if (abilitySlot.ability == null) { return; } if (!abilitySlot.CooldownReady()) { return; } castedAbility = abilitySlot.ability; Vector3 lookPoint = PlayerInfo.GetPlayerCursor().Position; //prepare cast and check if its valid abilitySlot.ability.PrepareCast(lookPoint, gameObject, castPosition, collisionLayer); if (!abilitySlot.ability.CastIsValid(gameObject)) { return; } //cast and set cooldown if (!scheduler.StartAction(this, true)) { return; } abilitySlot.SetCooldown(); if (abilitySlot.ability.shouldRotate) { RotateCharacter(lookPoint); } if (abilitySlot.ability.castImmediately) { abilitySlot.ability.CastAction(); } if (abilitySlot.ability.animationClip == null) { FinishedCast(); return; } //handle animation animator.SetTrigger("cast"); animator.SetTrigger("cast" + abilitySlot.index); /* ability cast is triggert by animation event CastAction() */ }
private void AttackBehaviour() { if (target.GetComponent <Health>().IsDead()) { return; } transform.LookAt(target.transform); if (timeSinceLastAttack > timeBetweenAttacks) { actionScheduler.StartAction(this); RestartAttackTimer(); TriggerAttack(); } }
public void StartMoveAction(Vector3 position, float speedFraction = 1f) { if (attackIsAnimating) { return; } if (GetComponent <Health>() != null && !GetComponent <Health>().Alive) { return; } ActionScheduler actionScheduler = GetComponent <ActionScheduler>(); actionScheduler.CancelCurrentAction(); actionScheduler.StartAction(this); MoveTo(position, Mathf.Clamp01(speedFraction)); }
public bool StartMoveAction(Vector3 direction, float deltaTime) { if (direction.magnitude == 0f) { Cancel(); return(false); } _currentMoveDirection = direction; _actionScheduler.StartAction(this); RotateInDirection(); MoveInDirection(deltaTime); UpdateAnimator(); return(true); }
public virtual void Attack(Health combatTarget, LayerMask layer) { if (!scheduler.StartAction(this, false)) { return; } float attackSpeed = stats.GetStat(Stat.AttackSpeed) * attackSpeedMuliplier; if (lastAttackTime + (1 / attackSpeed) > Time.time) { return; } lastAttackTime = Time.time; collisionLayer = layer; target = combatTarget; StartCoroutine(StartAttacking()); }
public bool StartFight() { _enemiesInFOV = enemiesInFOV.Items; if (_enemiesInFOV.Count == 0) { Cancel(); return(false); } if (_timeScinceLastAttack > baseStats.GetStat(Stat.AttackSpeed)) { _timeScinceLastAttack = 0f; _actionScheduler.StartAction(this); var position = FindClosestEnemyPosition(); RotateToClosestEnemy(position); UpdateAnimator(); return(true); } return(false); }
bool InteractWithMovement() { Vector3 target; bool hasHit = RaycastNavMesh(out target); if (hasHit) { if (!mover.CanMoveTo(target)) { return(false); } if (Input.GetMouseButton(0)) { actionScheduler.StartAction(mover);//OR fighter.CancelAttack(); mover.StartMoveAction(target); } SetCursor(CursorType.Movement); return(true); } return(false); }
public void StartMovementAction(Vector3 destination, float speedFraction) { _actionScheduler.StartAction(this); MoveTo(destination, speedFraction); }
private void AttackBehaviour() { _fighter.Attack(_player.GetComponent <CombatTarget>()); _scheduler.StartAction(_fighter); _lastKnownLocation = _player.transform.position; }
/// <summary> /// Schedule attack action to target /// </summary> /// <param name="combatTarget">The target to be attacked</param> public void Attack(GameObject combatTarget) { m_actionScheduler.StartAction(this); m_target = combatTarget.GetComponent <Health>(); }
public void Attack(GameObject combatTarget) { target = combatTarget.GetComponent <Health>(); scheduler.StartAction(this); print("BANG BOOM STRAIGHT TO THE MOON"); }
public void StartMoveAction(Vector3 destination, float speedModifier = 1f) { actionScheduler.StartAction(this); MoveTo(destination, speedModifier); }
public void Attack(CombatTarget combatTarget) { actionScheduler.StartAction(this); target = combatTarget.transform; }
public void Attack(GameObject target) { _actionScheduler.StartAction(this); _target = target.GetComponent <Health>(); }
public void StartMoveAction(Vector3 destination) { actionScheduler.StartAction(this); MoveTo(destination); }
public void StartMoveAction(Vector3 destination, float speedFraction) { // would cancels attack movement before doing regular movement actionScheduler.StartAction(this); MoveTo(destination, speedFraction); }