/// <summary>Try to Activate a State direclty from the Animal Script </summary> public virtual void State_Activate(int ID) { State NewState; if (statesD.TryGetValue(ID, out NewState)) { if (ActiveState.Priority > NewState.Priority && ActiveState.IgnoreLowerStates) { return; //if the Active state is set to ignore the lower ones then SKip } if (ActiveState == NewState) { return; //We are already on this state } if (ActiveState.IsPersistent) { return; //if the Active state is persitent then ignore the Activation } if (!NewState.Active || NewState.IsSleepFromState || NewState.IsSleepFromMode) { return; //if the New state is disabled or os sleep ignore Activation } // Debug.Log("Zone State: "+ ID); NewState.Activate(); } }
public virtual bool State_TryActivate(int ID) { State NewState; if (statesD.TryGetValue(ID, out NewState)) { if (ActiveState.Priority > NewState.Priority && ActiveState.IgnoreLowerStates) { return(false); //if the Active state is set to ignore the lower ones then SKip } if (ActiveState == NewState) { return(false); //We are already on this state } if (ActiveState.IsPersistent) { return(false); //if the Active state is persitent then ignore the Activation } if (!NewState.Active || NewState.IsSleepFromState || NewState.IsSleepFromMode) { return(false); //if the New state is disabled or os sleep ignore Activation } NewState.Activate(); } return(true); }
/// <summary>Try to Activate a State direclty from the Animal Script </summary> public virtual void State_Activate(int ID) { if (statesD.TryGetValue(ID, out State NewState)) { if (NewState.CanBeActivated) { NewState.Activate(); } } }
public virtual bool State_TryActivate(int ID) { if (statesD.TryGetValue(ID, out State NewState)) { if (NewState.CanBeActivated) { NewState.Activate(); return(true); } } return(false); }