Exemple #1
0
    public void ClaimNewWaypoint(WayPointType.PointType.WAYPOINT_TYPE wantedType, bool mustBeFree)
    {
        Waypoint newTarget = null;

        if (wantedType == WayPointType.PointType.WAYPOINT_TYPE.RETREATING)
        {
            newTarget = WayPointManager.ClosestWaypoint(transform.position, WayPointManager.GetAllRetreatWayPoints(), mustBeFree);
        }
        else if (wantedType == WayPointType.PointType.WAYPOINT_TYPE.READY_TO_FIGHT)
        {
            newTarget = WayPointManager.ClosestWaypoint(transform.position, WayPointManager.GetAllReadyToAttackWayPoints(), mustBeFree);
        }
        else if (wantedType == WayPointType.PointType.WAYPOINT_TYPE.ATTACKING)
        {
            newTarget = WayPointManager.ClosestWaypoint(transform.position, WayPointManager.GetAllAttackWayPoints(), mustBeFree);
        }
        if (m_CurrentTarget != null)
        {
            m_CurrentTarget.SetOwner(null);
        }
        if (newTarget != null)
        {
            m_CurrentTarget = newTarget;
            m_CurrentTarget.SetOwner(this.gameObject);
        }
        else
        {
            m_CurrentTarget = null;
        }
    }