Exemplo n.º 1
0
    protected override void UpdateIsVerfied(IStateMachineOwner owner)
    {
        Customer   customer = owner as Customer;
        Blackboard bb       = customer.GetComponent <Blackboard>();

        if (bb == null)
        {
            throw new System.Exception(string.Format("Cannot Find Blackboard in {0}", customer.name));
        }

        Vector3 des;

        if (bb.GetBBValue <Vector3>("NavTargetPos", out des))
        {
            Vector3 curPos = customer.transform.position;

            float distance = (des - curPos).magnitude;
            if (distance <= _distanceThreshold)
            {
                _isVerfied = true;
            }
            else
            {
                _isVerfied = false;
            }
        }
        else
        {
            Debug.Log(string.Format("{0} haven't set destination yet", customer.Data.CharacterName));
            _isVerfied = false;
        }
    }
    public override void DebugText(IStateMachineOwner owner)
    {
        string debugStr;

        debugStr = "(" + Right.GetName(owner);

        Debug.Log(debugStr);
    }
Exemplo n.º 3
0
    public override void OnExitState(IStateMachineOwner owner)
    {
        Customer customer = owner as Customer;

        Debug.Log(string.Format("{0} Exit ExitInnState", customer.Data.CharacterName));

        customer.LeaveInn();
    }
    public override void DebugText(IStateMachineOwner owner)
    {
        string debugStr;

        debugStr = Left.GetName(owner) + ")";

        Debug.Log(debugStr);
    }
Exemplo n.º 5
0
    public override void OnExitState(IStateMachineOwner owner)
    {
        Customer customer = owner as Customer;

        Debug.Log(string.Format("{0} Exit GotoSeatsState", customer.Data.CharacterName));

        //customer.StopMoving();
    }
Exemplo n.º 6
0
    public bool GetExpressionResult(IStateMachineOwner owner)
    {
        if (m_CacheOperatorList.Count > 0)
        {
            throw new System.Exception("Express Unit is not enough");
        }

        return(m_Result.GetValue(owner));
    }
Exemplo n.º 7
0
    public void Reset(IStateMachineOwner owner)
    {
        if (m_CacheOperatorList.Count > 0)
        {
            throw new System.Exception("Express Unit is not enough");
        }

        m_Result.Reset(owner);
    }
Exemplo n.º 8
0
 protected override void UpdateIsVerfied(IStateMachineOwner owner)
 {
     _timePassed += Time.deltaTime;
     if (_timePassed >= _timerDuration)
     {
         _isVerfied = true;
     }
     else
     {
         _isVerfied = false;
     }
 }
    public override void UnwrapTask()
    {
        ITaskAssignee assignee = this.TaskAssignee;

        IStateMachineOwner sm_Owner = assignee as IStateMachineOwner;

        if (sm_Owner != null)
        {
            StateMachine sm = sm_Owner.GetStateMachine();
            sm.TransitToExternalState(_externalState);
        }
    }
Exemplo n.º 10
0
    public override void OnEnterState(IStateMachineOwner owner)
    {
        if (owner.GetType() != typeof(Customer))
        {
            Object ownerObject = owner as Object;
            Debug.LogError(string.Format("{0} is not customer, cannot use ExitInnState", ownerObject.name));
            throw new System.Exception("Wrong State Usage");
        }

        Customer customer = owner as Customer;

        Debug.Log(string.Format("{0} Enter PayBillState", customer.Data.CharacterName));
    }
Exemplo n.º 11
0
    public override void DebugText(IStateMachineOwner owner)
    {
        if (owner == null)
        {
            return;
        }

        string debugStr;

        debugStr = Left.GetName(owner) + " And " + Right.GetName(owner);

        Debug.Log(debugStr);
    }
Exemplo n.º 12
0
    public override void OnExitState(IStateMachineOwner owner)
    {
        Customer customer = owner as Customer;

        Debug.Log(string.Format("{0} Exit PayBillState", customer.Data.CharacterName));

        Blackboard customer_bb = customer.GetComponent <Blackboard>();

        if (customer_bb)
        {
            if (customer_bb.GetBBValue <Table>("Table", out Table table))
            {
                table.OnCustomerLeave();
            }
        }
    }
Exemplo n.º 13
0
    public override void OnEnterState(IStateMachineOwner owner)
    {
        if (owner.GetType() != typeof(Customer))
        {
            Object ownerObject = owner as Object;
            Debug.LogError(string.Format("{0} is not customer, cannot use ExitInnState", ownerObject.name));
            throw new System.Exception("Wrong State Usage");
        }

        Customer customer = owner as Customer;

        Debug.Log(string.Format("{0} Enter ExitInnState", customer.Data.CharacterName));

        InnManager inn = Utils.GetGameManager().GetInnManager();

        customer.MoveToLocation(inn.GetExitLocation());
    }
Exemplo n.º 14
0
    public override void OnEnterState(IStateMachineOwner owner)
    {
        if (owner.GetType() != typeof(Customer))
        {
            Object ownerObject = owner as Object;
            Debug.LogError(string.Format("{0} is not customer, cannot use GotoSeatsState", ownerObject.name));
            throw new System.Exception("Wrong State Usage");
        }

        Customer customer = owner as Customer;

        Debug.Log(string.Format("{0} Enter GotoSeatsState", customer.Data.CharacterName));
        Utils.GetGameManager().GetUIManager().PopoutNewMessage(customer.gameObject, "Enter GotoSeatsState");

        if (customer.GetIsLeader())
        {
            InnManager innManager = Utils.GetGameManager().GetInnManager();

            Table table;
            if (innManager.QueryTable(customer, out table))
            {
                Vector3 des = table.PopOutSeats(customer);

                Blackboard leader_bb = customer.GetComponent <Blackboard>();
                leader_bb.AddOrModifyBBValue <Table>("Table", table);

                CustomerGroup group = CustomerGroup.GetGroupViaLeader(customer);

                foreach (Customer member in group._Members)
                {
                    Blackboard member_bb = member.GetComponent <Blackboard>();
                    member_bb.AddOrModifyBBValue <Table>("Table", table);
                }

                customer.MoveToLocation(des);
                _destinationSettled = true;
            }
        }
        else
        {
            //non-leader should follow leader decisions.
        }
    }
Exemplo n.º 15
0
    public override void OnUpdateState(IStateMachineOwner owner)
    {
        Customer customer = owner as Customer;

        //Debug.Log(string.Format("{0} Update GotoSeatsState", customer.Data.CharacterName));

        if (!customer.GetIsLeader() && !_destinationSettled)
        {
            Table      targetTable;
            Blackboard customer_bb = customer.GetComponent <Blackboard>();
            if (customer_bb)
            {
                if (customer_bb.GetBBValue <Table>("Table", out targetTable))
                {
                    Vector3 des = targetTable.PopOutSeats(customer);
                    customer.MoveToLocation(des);
                    _destinationSettled = true;
                }
            }
        }
    }
Exemplo n.º 16
0
 public string GetName(IStateMachineOwner owner)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 17
0
 public override void OnUpdateState(IStateMachineOwner owner)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 18
0
 public abstract void OnTransition(IStateMachineOwner owner);
Exemplo n.º 19
0
 public abstract bool IsValid(IStateMachineOwner owner);
 public override void OnTransition(IStateMachineOwner owner)
 {
     _Expression.Reset(owner);
 }
Exemplo n.º 21
0
 public override void OnUpdateState(IStateMachineOwner owner)
 {
 }
Exemplo n.º 22
0
 public override void ResetCondition(IStateMachineOwner owner)
 {
     base.ResetCondition(owner);
     _timePassed = 0;
 }
Exemplo n.º 23
0
 protected override void UpdateIsVerfied(IStateMachineOwner owner)
 {
     _isVerfied = true;
 }
Exemplo n.º 24
0
 public bool GetValue(IStateMachineOwner owner)
 {
     return(GetIsVerfied(owner));
 }
Exemplo n.º 25
0
 public override void OnUpdateState(IStateMachineOwner owner)
 {
     Customer customer = owner as Customer;
     //Debug.Log(string.Format("{0} Update CallWaiterState", customer.Data.CharacterName));
 }
Exemplo n.º 26
0
 public bool GetIsVerfied(IStateMachineOwner owner)
 {
     UpdateIsVerfied(owner);
     return(_isVerfied);
 }
Exemplo n.º 27
0
 public new string GetName(IStateMachineOwner owner)
 {
     return("true");
 }
Exemplo n.º 28
0
 public void Reset(IStateMachineOwner owner)
 {
     ResetCondition(owner);
 }
Exemplo n.º 29
0
 public virtual void ResetCondition(IStateMachineOwner owner)
 {
     _isVerfied = false;
 }
Exemplo n.º 30
0
 protected abstract void UpdateIsVerfied(IStateMachineOwner owner);