private void BeDamaged() { if(! _movement.isGrounded) return; if(debugMode) Debug.Log("Garlan is no longer damaged."); _action = GarlanSequenceActions.None; _isDamaged = false; _nextDecision = Time.time + DecisionTime; }
private void SummonBlock() { int randomX = Random.Range((int) topLeftBlockCoordinate.x, (int) bottomRightBlockCoordinate.x); int randomY = Random.Range((int) bottomRightBlockCoordinate.x, (int) topLeftBlockCoordinate.y); Vector3 newCoord = new Vector3(randomX, randomY, transform.position.z); if(debugMode) Debug.Log("Summoning new block to " + newCoord); Instantiate(block, newCoord, Quaternion.identity); _action = GarlanSequenceActions.None; _currentAnimation = "Attack-Left"; // TODO: Casting animation... _isDamaged = false; _nextDecision = Time.time + DecisionTime; }
private void RollNewAction() { _isDamaged = false; // Are we still thinking about what to do? If so, // keep thinking, and show off that idle pose. if(Time.time < _nextDecision) { DetermineDirection("Idle"); return; } // When rolling, determine if I can still see the player. // If not, we must find him! if(! _sense.DetectedPlayer) { if(debugMode) Debug.Log("Garlan is seeking the player!"); _action = GarlanSequenceActions.Seek; return; } // So, we've thought it over, and can see the player. // Decision time. _action = GarlanSequenceActions.Attack; int roll = Random.Range(1, 100); foreach(GarlanBehaviorRoll current in behaviorRolls) { if(roll < current.probability) { _action = current.state; break; } } if(debugMode) Debug.Log("Rolled decision: " + roll); }
private void SeekPlayer() { TurnAroundIfFacingWall(); PerformMove(); // If we can now see the player, time to decide what // we are going to do to him. if(_sense.DetectedPlayer) { if(debugMode) Debug.Log("Garlan has found the player!"); _action = GarlanSequenceActions.None; } }
private void ChargePlayer() { if(! _isCharging) { _isCharging = true; FacePlayer(); DetermineDirection("Attack"); } PerformMove(); // If close enough to where the player was, decide what to do next. if(Vector3.Distance(transform.position, _playerLocation) <= ChargeHaltRange) { _isCharging = false; _action = GarlanSequenceActions.None; _nextDecision = Time.time + DecisionTime; } }