예제 #1
0
        public MurdererContext(HTNPlayer body, MurdererDomain 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 (MurdererContext._worldStateChanges == null)
                {
                    MurdererContext._worldStateChanges = new Stack <WorldStateInfo> [length];
                    for (int i = 0; i < length; i++)
                    {
                        MurdererContext._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.MurdererContext != this)
            {
                this.Memory = new MurdererMemory(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;
                }
            }
            this._worldState[31]         = 1;
            this._previousWorldState[31] = 1;
        }
예제 #2
0
        public MurdererContext(HTNPlayer body, MurdererDomain 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 (MurdererContext._worldStateChanges == null)
                {
                    MurdererContext._worldStateChanges = new Stack <WorldStateInfo> [length];
                    for (int index = 0; index < length; ++index)
                    {
                        MurdererContext._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.MurdererContext != this)
            {
                this.Memory = new MurdererMemory(this);
            }
            if (Object.op_Equality((Object)this.Location, (Object)null))
            {
                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;
                    }
                }
            }
            this._worldState[31]         = (byte)1;
            this._previousWorldState[31] = (byte)1;
        }