public void ActionDone() { currentAction = ActionEnum.Action.Nothing; //to delete, juste for debug StopWalking(); actionCB = null; ResetCallback(); actionList.Clear(); AnimationDone(); StopAllCoroutines(); }
public void StopWalking() { currentAction = ActionEnum.Action.Nothing; //to delete, juste for debug destination = null; nav.SetDestination(gameObject.transform.position); walking = false; if (actionList.Count > 0 && actionList[0].type == ActionEnum.Action.Walk) { AnimationDone(); } }
//all action of the AI #region Action protected void actionBase(ActionEnum.Action action) { anim = true; if (alcoolPerAction.ContainsKey(action)) { GetDrunk(alcoolPerAction[action]); } if (humorPerAction.ContainsKey(action)) { GetHappy(humorPerAction[action]); } }
public float GetPourcentage(ActionEnum.Action type, float currentHumor, float currentAlcool) { int actionNbr = 0; while (actionNbr < action.Length && type != action[actionNbr]) { actionNbr++; } if (actionNbr >= action.Length) { return(0.0f); } return((humor[actionNbr].Evaluate(currentHumor) + alcool[actionNbr].Evaluate(currentAlcool)) / 2); }
// Update is called once per frame protected virtual void Update() { if (forceActionDone) { ActionDone(); } if (walking && (destination == null || destination.transform.position.x != nav.destination.x || destination.transform.position.z != nav.destination.z)) { ActionDone(); } if (!walking && !anim && actionList.Count != 0) { currentAction = actionList[0].type; //to delete, juste for debug actionMethode[actionList[0].type](); } if (actionList.Count == 0) { SelectAction(); } }
public void AddAction(ActionEnum.Action action, GameObject go = null) { actions.Add(action); goOfAction.Add(go); }
public void AddAction(ActionEnum.Action newAction, GameObject go) { actionList.Add(new ActionEnum.ActionData(newAction, go)); }