private void Start() { agentStateManager = this.GetComponent <AgentStateManager>(); this.OnTriggerEnterAsObservable() .Where(collision => collision.tag == "Explosion") .Subscribe(_ => agentStateManager.SetPlayerState(AgentState.Collapse)); }
// Start is called before the first frame update void Start() { agentStateManager = this.GetComponent <AgentStateManager>(); agentStateManager .CurrentPlayerState .Where(state => state == AgentState.Collapse) .Delay(TimeSpan.FromSeconds(1.0f)) .Subscribe(_ => agentStateManager.SetPlayerState(AgentState.Idle)) .AddTo(this); }