virtual public void StartNewAction() { float shouldMoveConfidence = 0; float shouldAttackConfidence = 0; if (movementBehaviour) { shouldMoveConfidence = movementBehaviour.ShouldMove(); } if (attackBehaviour) { shouldAttackConfidence = attackBehaviour.ShouldAttack(); } if (shouldMoveConfidence == 0 && shouldAttackConfidence == 0) { return; } float totalConfidence = shouldMoveConfidence + shouldAttackConfidence; float random = UnityEngine.Random.Range(0, totalConfidence); if (random < shouldMoveConfidence) { movementBehaviour.Move(); } else { attackBehaviour.Attack(); } }
public void TurnOn() { _movingBehaviour = GetComponent <MovementBehaviour>(); if (_movingBehaviour != null) { _movingBehaviour.Move(); } StartCoroutine(SawAnimation()); }
// Update is called once per frame void Update() { // Rotate movement.Rotate(); // Move movement.Move(); // Shoot attack.Shoot(); // Reload attack.ReloadInit(); shootCooldown -= Time.deltaTime; }
private void Aggro() { if (Target != null) { movement.Move(Target); if (!aggro.TargetStillInRange(Target)) { EnemyState = EntityState.Idle; return; } if (attack.AllowedToAttack()) { EnemyState = EntityState.Attack; return; } } else { EnemyState = EntityState.Idle; } }
public void Move(float direction) { body = movement.Move(body, bodyTransform, direction); }
private void Update() { Movement.Move(MovementAction.action.ReadValue <Vector2>()); Turret.RotateByMousePosition(TurretRotationAction.action.ReadValue <Vector2>()); }
private void FixedUpdate() { movementBehaviour.Move(transform.up * -1); }
private void FixedUpdate() { // Already handles a null velocity. movementBehaviour.Move(transform.right * horizontalMovement); }
public void Move(float direction) { parentBody = movement.Move(parentBody, parentTransform, direction); }