public override int GetHashCode() { int hash = 1; if (UserId != 0) { hash ^= UserId.GetHashCode(); } if (SceneId != 0) { hash ^= SceneId.GetHashCode(); } if (PubState != 0) { hash ^= PubState.GetHashCode(); } hash ^= selectIds_.GetHashCode(); if (CreateTime != 0L) { hash ^= CreateTime.GetHashCode(); } if (PubTime != 0L) { hash ^= PubTime.GetHashCode(); } if (TipState != 0) { hash ^= TipState.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (UserId != 0) { hash ^= UserId.GetHashCode(); } if (SceneId != 0) { hash ^= SceneId.GetHashCode(); } if (Like != 0) { hash ^= Like.GetHashCode(); } if (PubState != 0) { hash ^= PubState.GetHashCode(); } if (SelectState != 0) { hash ^= SelectState.GetHashCode(); } if (SelectIndex != 0) { hash ^= SelectIndex.GetHashCode(); } if (CreateTime != 0L) { hash ^= CreateTime.GetHashCode(); } if (TipState != 0) { hash ^= TipState.GetHashCode(); } return(hash); }
public void ChangeOpenStatus(PubState state) { CurrentState = state; }
private void ChangePubState(PubState state) { Pub.ChangeOpenStatus(state); }
private IEnumerator StateGen() { int node = 0; NodeVal ret = NodeVal.Error; _jmp = -1; comp_Animator = GetComponent <Animator>(); float f1 = 0.0f; int n0_1i = 0; int n10c = -1; int n1c = -1; int n25c = -1; int n26c = -1; int n2c = -1; int n3c = -1; int n4c = -1; int n9c = -1; NodeVal n1_1r = NodeVal.Invalid; NodeVal n10_1r = NodeVal.Invalid; NodeVal n2_1r = NodeVal.Invalid; NodeVal n26_1r = NodeVal.Invalid; NodeVal n3_1r = NodeVal.Invalid; NodeVal n4_1r = NodeVal.Invalid; NodeVal r1 = NodeVal.Invalid; NodeVal r2 = NodeVal.Invalid; NodeVal r3 = NodeVal.Invalid; NodeVal r4 = NodeVal.Invalid; NodeVal r5 = NodeVal.Invalid; Vector3 v1 = Vector3.zero; valid = valid && (comp_Animator != null); if (!valid) { throw new BehaviourTreeException("Behaviour tree will not run. The GameObject has missing required components."); } do { switch (node) { case 0: #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(23, _liveHandle, NodeVal.Running, false, true); } #endif n0_1i = 0; node = EvalMouseBehaviourPicker(ref n0_1i); break; case 30: if (_jmp >= 0) { node = _jmp; _jmp = -1; continue; } if (!(ret == NodeVal.Success || ret == NodeVal.Running) && n0_1i != 15) { node = EvalMouseBehaviourPicker(ref n0_1i); break; } node = 0; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(23, _liveHandle, ret, true, false); } #endif yield return(null); break; case 1: _pubState = PubState.FleeFromCat; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(30, _liveHandle, NodeVal.Running, false, false); } #endif n1c = 5; node = 5; n1_1r = NodeVal.Success; break; case 31: n1_1r = (NodeVal)System.Math.Max((int)n1_1r, (int)ret); if (ret == NodeVal.Success && n1c < 6) { node = ++n1c; } else { n1c = 5; node = 30; ret = n1_1r; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(30, _liveHandle, ret, false, false); } #endif } break; case 2: _pubState = PubState.GetCheese; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(29, _liveHandle, NodeVal.Running, false, false); } #endif n2c = 7; node = 7; n2_1r = NodeVal.Success; break; case 32: n2_1r = (NodeVal)System.Math.Max((int)n2_1r, (int)ret); if (ret == NodeVal.Success && n2c < 9) { node = ++n2c; } else { n2c = 7; node = 30; ret = n2_1r; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(29, _liveHandle, ret, false, false); } #endif } break; case 3: _pubState = PubState.Idle; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(8, _liveHandle, NodeVal.Running, false, false); } #endif n3c = 14; node = 14; n3_1r = NodeVal.Success; break; case 33: n3_1r = (NodeVal)System.Math.Max((int)n3_1r, (int)ret); if (ret == NodeVal.Success && n3c < 18) { node = ++n3c; } else { n3c = 14; node = 30; ret = n3_1r; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(8, _liveHandle, ret, false, false); } #endif } break; case 4: #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(9, _liveHandle, NodeVal.Running, false, false); } #endif n4c = 24; node = 24; n4_1r = NodeVal.Success; break; case 34: n4_1r = (NodeVal)System.Math.Max((int)n4_1r, (int)ret); if (ret == NodeVal.Success && n4c < 25) { node = ++n4c; } else { n4c = 24; node = 30; ret = n4_1r; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(9, _liveHandle, ret, false, false); } #endif } break; case 5: ret = (this.SignalBehaviourOnScreen("Flee from cat")); node = 31; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(25, _liveHandle, ret, false, false); } #endif break; case 6: f1 = Time.time; do { v1 = this.CatPosition(); transform.position = Vector3.MoveTowards(transform.position, v1, -2f * Time.deltaTime); ret = (transform.position == v1)? NodeVal.Success : NodeVal.Running; if (ret == NodeVal.Running) { if ((Time.time - f1) > 1f) { ret = NodeVal.Success; node = 31; yield return(null); break; } #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(26, _liveHandle, NodeVal.Running, true, false); } #endif yield return(null); } else { node = 31; break; } } while (true); #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(26, _liveHandle, ret, false, false); } #endif break; case 7: ret = (this.CheeseIsAvailable())? NodeVal.Success : NodeVal.Fail; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(28, _liveHandle, ret, false, false); } #endif node = 32; break; case 8: ret = (this.SignalBehaviourOnScreen("Getting cheese")); node = 32; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(27, _liveHandle, ret, false, false); } #endif break; case 9: #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(10, _liveHandle, NodeVal.Running, false, false); } #endif n9c = 10; node = 10; break; case 39: if (ret != NodeVal.Success) { if (++n9c > 11) { n9c = 10; node = 32; } else { node = n9c; } } else { n9c = 10; node = 32; } #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(10, _liveHandle, ret, false, false); } #endif break; case 10: #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(11, _liveHandle, NodeVal.Running, false, false); } #endif n10c = 12; node = 12; n10_1r = NodeVal.Success; break; case 40: n10_1r = (NodeVal)System.Math.Max((int)n10_1r, (int)ret); if (ret == NodeVal.Success && n10c < 13) { node = ++n10c; } else { n10c = 12; node = 39; ret = n10_1r; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(11, _liveHandle, ret, false, false); } #endif } break; case 11: v1 = this.ClosestCheese(); transform.position = Vector3.MoveTowards(transform.position, v1, 1.2f * Time.deltaTime); ret = (transform.position == v1)? NodeVal.Success : NodeVal.Running; node = 39; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(12, _liveHandle, ret, false, false); } #endif break; case 12: ret = ((transform.position - this.ClosestCheese()).sqrMagnitude < (0f))? NodeVal.Success : NodeVal.Fail; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(13, _liveHandle, ret, false, false); } #endif node = 40; break; case 13: ret = (this.EatClosestCheese()); node = 40; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(14, _liveHandle, ret, false, false); } #endif break; case 14: ret = (this.SignalBehaviourOnScreen("Attack! (Rush at cat)")); node = 33; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(2, _liveHandle, ret, false, false); } #endif break; case 15: do { v1 = this.CatPosition(); transform.position = Vector3.MoveTowards(transform.position, v1, 4f * Time.deltaTime); ret = (transform.position == v1)? NodeVal.Success : NodeVal.Running; if (ret == NodeVal.Running) { if (this.CatWithinDistance(0.3f)) { ret = NodeVal.Success; node = 33; yield return(null); break; } #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(1, _liveHandle, NodeVal.Running, true, false); } #endif yield return(null); } else { node = 33; break; } } while (true); #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(1, _liveHandle, ret, false, false); } #endif break; case 16: f1 = Time.time; r1 = NodeVal.Running; r2 = NodeVal.Running; r3 = NodeVal.Running; r4 = NodeVal.Running; r5 = NodeVal.Running; ret = NodeVal.Success; do { if (r1 == NodeVal.Running) { /* Show is attacking 1 */ r1 = (this.SignalBehaviourOnScreen("Attack! (Pow!)")); } ret = r1; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(18, _liveHandle, r1, false, false); } #endif if (r2 == NodeVal.Running) { /* Action 3 */ r2 = (this.AttackCat()); } ret = (NodeVal)System.Math.Max((int)r2, (int)ret); #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(15, _liveHandle, r2, false, false); } #endif if (r3 == NodeVal.Running) { /* Trigger pow animation */ comp_Animator.SetTrigger("Pow"); r3 = NodeVal.Success; } ret = (NodeVal)System.Math.Max((int)r3, (int)ret); #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(0, _liveHandle, r3, false, false); } #endif if (r4 == NodeVal.Running) { /* Wait for animation end */ r4 = ((Time.time - f1) > 0.75f)? NodeVal.Success : NodeVal.Running; } ret = (NodeVal)System.Math.Max((int)r4, (int)ret); #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(16, _liveHandle, r4, false, false); } #endif if (r5 == NodeVal.Running) { /* Action 2 */ r5 = (this.ChooseIdleTarget()); } ret = (NodeVal)System.Math.Max((int)r5, (int)ret); #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(17, _liveHandle, r5, false, false); } #endif if (ret == NodeVal.Running) { #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(3, _liveHandle, NodeVal.Running, true, false); } #endif yield return(null); } else { node = 33; break; } } while (true); #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(3, _liveHandle, ret, false, false); } #endif break; case 17: ret = (this.SignalBehaviourOnScreen("Attack! (Retreat!)")); node = 33; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(4, _liveHandle, ret, false, false); } #endif break; case 18: do { v1 = this.IdleTarget; transform.position = Vector3.MoveTowards(transform.position, v1, 4f * Time.deltaTime); ret = (transform.position == v1)? NodeVal.Success : NodeVal.Running; if (ret == NodeVal.Running) { #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(5, _liveHandle, NodeVal.Running, true, false); } #endif yield return(null); } else { node = 33; break; } } while (true); #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(5, _liveHandle, ret, false, false); } #endif break; case 24: ret = (this.SignalBehaviourOnScreen("Idling")); node = 34; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(6, _liveHandle, ret, false, false); } #endif break; case 25: #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(7, _liveHandle, NodeVal.Running, false, false); } #endif n25c = 26; node = 26; break; case 55: if (ret != NodeVal.Success) { if (++n25c > 27) { n25c = 26; node = 34; } else { node = n25c; } } else { n25c = 26; node = 34; } #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(7, _liveHandle, ret, false, false); } #endif break; case 26: #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(22, _liveHandle, NodeVal.Running, false, false); } #endif n26c = 28; node = 28; n26_1r = NodeVal.Success; break; case 56: n26_1r = (NodeVal)System.Math.Max((int)n26_1r, (int)ret); if (ret == NodeVal.Success && n26c < 29) { node = ++n26c; } else { n26c = 28; node = 55; ret = n26_1r; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(22, _liveHandle, ret, false, false); } #endif } break; case 27: v1 = this.IdleTarget; transform.position = Vector3.MoveTowards(transform.position, v1, 0.4f * Time.deltaTime); ret = (transform.position == v1)? NodeVal.Success : NodeVal.Running; node = 55; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(21, _liveHandle, ret, false, false); } #endif break; case 28: ret = ((transform.position - this.IdleTarget).sqrMagnitude < (0f))? NodeVal.Success : NodeVal.Fail; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(19, _liveHandle, ret, false, false); } #endif node = 56; break; case 29: ret = (this.ChooseIdleTarget()); node = 56; #if UNITY_EDITOR if (_live != null) { _live = _live.SetLiveValue(20, _liveHandle, ret, false, false); } #endif break; } } while (node >= 0); yield return(null); }