| 123456789101112131415161718192021 |
- using UnityEngine;
- [CreateAssetMenu(fileName = "OffensiveStrategy", menuName = "Hockey/Strategies/Offensive")]
- public class OffensiveStrategy : AIStrategy
- {
- public override Vector3 GetTargetPosition(PlayerController player, Transform puck)
- {
- // Move towards offensive zone
- return new Vector3(puck.position.x, 0, player.transform.position.z + 5f);
- }
- public override PlayerAction DecideAction(PlayerController player, bool hasPuck)
- {
- if (hasPuck)
- {
- float shootChance = player.mentality.shootingTendency / 100f;
- return Random.value < shootChance ? PlayerAction.Shoot : PlayerAction.Pass;
- }
- return PlayerAction.SupportTeammate;
- }
- }
|