public NPCTurretContext(HTNPlayer body, NPCTurretDomain domain) { int length = System.Enum.GetValues(typeof(Facts)).Length; if (this._worldState == null || this._worldState.Length != length) { this._worldState = new byte[length]; this._previousWorldState = new byte[length]; if (NPCTurretContext._worldStateChanges == null) { NPCTurretContext._worldStateChanges = new Stack <WorldStateInfo> [length]; for (int index = 0; index < length; ++index) { NPCTurretContext._worldStateChanges[index] = new Stack <WorldStateInfo>(5); } } } this._decompositionScore = int.MaxValue; this.Body = body; this.Domain = domain; this.PlanState = (PlanStateType)0; if (this.Memory == null || this.Memory.NPCTurretContext != this) { this.Memory = new NPCTurretMemory(this); } if (!Object.op_Equality((Object)this.Location, (Object)null)) { return; } float num = float.MaxValue; foreach (AiLocationManager manager in AiLocationManager.Managers) { Vector3 vector3 = Vector3.op_Subtraction(((Component)manager).get_transform().get_position(), ((Component)this.Body).get_transform().get_position()); float sqrMagnitude = ((Vector3) ref vector3).get_sqrMagnitude(); if ((double)sqrMagnitude < (double)num) { num = sqrMagnitude; this.Location = manager; } } }
public NPCTurretContext(HTNPlayer body, NPCTurretDomain domain) { int length = Enum.GetValues(typeof(Facts)).Length; if (this._worldState == null || (int)this._worldState.Length != length) { this._worldState = new byte[length]; this._previousWorldState = new byte[length]; if (NPCTurretContext._worldStateChanges == null) { NPCTurretContext._worldStateChanges = new Stack <WorldStateInfo> [length]; for (int i = 0; i < length; i++) { NPCTurretContext._worldStateChanges[i] = new Stack <WorldStateInfo>(5); } } } this._decompositionScore = 2147483647; this.Body = body; this.Domain = domain; this.PlanState = PlanStateType.NoPlan; if (this.Memory == null || this.Memory.NPCTurretContext != this) { this.Memory = new NPCTurretMemory(this); } if (this.Location == null) { float single = Single.MaxValue; foreach (AiLocationManager manager in AiLocationManager.Managers) { Vector3 vector3 = manager.transform.position - this.Body.transform.position; float single1 = vector3.sqrMagnitude; if (single1 >= single) { continue; } single = single1; this.Location = manager; } } }