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); }
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); }
public override void OnExitState(IStateMachineOwner owner) { Customer customer = owner as Customer; Debug.Log(string.Format("{0} Exit GotoSeatsState", customer.Data.CharacterName)); //customer.StopMoving(); }
public bool GetExpressionResult(IStateMachineOwner owner) { if (m_CacheOperatorList.Count > 0) { throw new System.Exception("Express Unit is not enough"); } return(m_Result.GetValue(owner)); }
public void Reset(IStateMachineOwner owner) { if (m_CacheOperatorList.Count > 0) { throw new System.Exception("Express Unit is not enough"); } m_Result.Reset(owner); }
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); } }
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)); }
public override void DebugText(IStateMachineOwner owner) { if (owner == null) { return; } string debugStr; debugStr = Left.GetName(owner) + " And " + Right.GetName(owner); Debug.Log(debugStr); }
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(); } } }
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()); }
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. } }
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; } } } }
public string GetName(IStateMachineOwner owner) { throw new System.NotImplementedException(); }
public override void OnUpdateState(IStateMachineOwner owner) { throw new System.NotImplementedException(); }
public abstract void OnTransition(IStateMachineOwner owner);
public abstract bool IsValid(IStateMachineOwner owner);
public override void OnTransition(IStateMachineOwner owner) { _Expression.Reset(owner); }
public override void OnUpdateState(IStateMachineOwner owner) { }
public override void ResetCondition(IStateMachineOwner owner) { base.ResetCondition(owner); _timePassed = 0; }
protected override void UpdateIsVerfied(IStateMachineOwner owner) { _isVerfied = true; }
public bool GetValue(IStateMachineOwner owner) { return(GetIsVerfied(owner)); }
public override void OnUpdateState(IStateMachineOwner owner) { Customer customer = owner as Customer; //Debug.Log(string.Format("{0} Update CallWaiterState", customer.Data.CharacterName)); }
public bool GetIsVerfied(IStateMachineOwner owner) { UpdateIsVerfied(owner); return(_isVerfied); }
public new string GetName(IStateMachineOwner owner) { return("true"); }
public void Reset(IStateMachineOwner owner) { ResetCondition(owner); }
public virtual void ResetCondition(IStateMachineOwner owner) { _isVerfied = false; }
protected abstract void UpdateIsVerfied(IStateMachineOwner owner);