private void Start() { wanderingDistanceFromCampfire.max = GameManager.instance.zoneRadius - 2.0f; agent.SetDestination(Tools.RandomPointOnCircle(wanderingDistanceFromCampfire)); agent.speed = speed.min; state = ThiefWolfState.WANDER; currentWanderingTime = 0.0f; attacker.SetEnableAttack(false); }
private void CheckChaseLogState() { if (GameManager.instance.logs.Count == 0 || targetLog == null) { agent.SetDestination(Tools.RandomPointOnCircle(wanderingDistanceFromCampfire)); agent.speed = speed.min; state = ThiefWolfState.WANDER; currentWanderingTime = 0.0f; attacker.SetEnableAttack(false); } else if (pickSensor.m_selectedPickable != null) { pickSensor.PickUp(); agent.SetDestination(transform.position.normalized * (GameManager.instance.zoneRadius + GameManager.instance.enemyGenerator.zoneOffset)); agent.speed = speed.max; state = ThiefWolfState.FLEE; attacker.SetEnableAttack(true); } }
private void CheckWanderState() { targetLog = TryToGetNearestLog(); if (targetLog != null) { agent.SetDestination(targetLog.transform.position); agent.speed = speed.max; state = ThiefWolfState.CHASELOG; attacker.SetEnableAttack(true); } else if (currentWanderingTime >= maxWanderingTime) { agent.SetDestination(transform.position.normalized * (GameManager.instance.zoneRadius + GameManager.instance.enemyGenerator.zoneOffset)); agent.speed = speed.max; state = ThiefWolfState.FLEE; attacker.SetEnableAttack(true); } else if (agent.remainingDistance <= 0.1f) { agent.SetDestination(Tools.RandomPointOnCircle(wanderingDistanceFromCampfire)); } }