Esempio n. 1
0
        protected void TableSetting(AnimalTypes _animalType, BreedingTypes _breedingType)
        {
            this.StateConditionTable.Clear();
            this.StateNonOverlapTable.Clear();
            Dictionary <AnimalState, StateCondition> dictionary1;

            if (this.AnimalTable.StateConditionTable.ContainsKey(_animalType) && this.AnimalTable.StateConditionTable[_animalType].TryGetValue(_breedingType, out dictionary1))
            {
                foreach (KeyValuePair <AnimalState, StateCondition> keyValuePair in dictionary1)
                {
                    this.StateConditionTable[keyValuePair.Key] = new StateCondition(keyValuePair.Value);
                }
            }
            this.TargetActionTable.Clear();
            Dictionary <AnimalState, List <ActionTypes> > dictionary2;

            if (!this.AnimalTable.StateTargetActionTable.ContainsKey(_animalType) || !this.AnimalTable.StateTargetActionTable[_animalType].TryGetValue(_breedingType, out dictionary2))
            {
                return;
            }
            foreach (KeyValuePair <AnimalState, List <ActionTypes> > keyValuePair in dictionary2)
            {
                this.TargetActionTable[keyValuePair.Key] = new List <ActionTypes>((IEnumerable <ActionTypes>)keyValuePair.Value);
            }
        }
Esempio n. 2
0
 public AnimalInfo(
     AnimalTypes _animalType,
     BreedingTypes _breedingType,
     string _name,
     string _identifierName,
     int _animalID,
     int _chunkID,
     AnimalModelInfo _modelInfo)
 {
     this.AnimalType     = _animalType;
     this.BreedingType   = _breedingType;
     this.Name           = _name;
     this.IdentifierName = _identifierName;
     this.AnimalID       = _animalID;
     this.ModelInfo      = _modelInfo;
 }
        private void DesireTableSetting()
        {
            AnimalTypes   animalType   = this.AnimalType;
            BreedingTypes breedingType = this.BreedingType;

            this.ClearTable();
            foreach (DesireType desireTypeElement in AnimalDesireController.DesireTypeElements)
            {
                this.ParamTable[desireTypeElement] = 0.0f;
            }
            Dictionary <BreedingTypes, Dictionary <int, DesireType> > dictionary1;
            Dictionary <int, DesireType> dictionary2;

            if (this.AnimalTable.DesirePriorityTable.TryGetValue(animalType, out dictionary1) && dictionary1.TryGetValue(breedingType, out dictionary2))
            {
                foreach (KeyValuePair <int, DesireType> keyValuePair in dictionary2)
                {
                    this.PriorityTable[keyValuePair.Key] = keyValuePair.Value;
                    this.PriorityList.Add(keyValuePair.Key);
                }
                this.PriorityList.Sort();
            }
            Dictionary <BreedingTypes, Dictionary <DesireType, int> > dictionary3;
            Dictionary <DesireType, int> dictionary4;

            if (this.AnimalTable.DesireSpanTable.TryGetValue(animalType, out dictionary3) && dictionary3.TryGetValue(breedingType, out dictionary4))
            {
                foreach (KeyValuePair <DesireType, int> keyValuePair in dictionary4)
                {
                    this.SpanTable[keyValuePair.Key] = keyValuePair.Value;
                }
            }
            Dictionary <BreedingTypes, Dictionary <DesireType, Tuple <float, float> > > dictionary5;
            Dictionary <DesireType, Tuple <float, float> > dictionary6;

            if (this.AnimalTable.DesireBorderTable.TryGetValue(animalType, out dictionary5) && dictionary5.TryGetValue(breedingType, out dictionary6))
            {
                foreach (KeyValuePair <DesireType, Tuple <float, float> > keyValuePair in dictionary6)
                {
                    this.BorderTable[keyValuePair.Key] = keyValuePair.Value;
                }
            }
            Dictionary <BreedingTypes, Dictionary <AnimalState, Dictionary <DesireType, float> > > dictionary7;
            Dictionary <AnimalState, Dictionary <DesireType, float> > dictionary8;

            if (this.AnimalTable.DesireRateTable.TryGetValue(animalType, out dictionary7) && dictionary7.TryGetValue(breedingType, out dictionary8))
            {
                foreach (KeyValuePair <AnimalState, Dictionary <DesireType, float> > keyValuePair1 in dictionary8)
                {
                    this.RateTable[keyValuePair1.Key] = new Dictionary <DesireType, float>();
                    foreach (KeyValuePair <DesireType, float> keyValuePair2 in keyValuePair1.Value)
                    {
                        this.RateTable[keyValuePair1.Key][keyValuePair2.Key] = keyValuePair2.Value;
                    }
                }
            }
            Dictionary <BreedingTypes, Dictionary <DesireType, List <AnimalState> > > dictionary9;
            Dictionary <DesireType, List <AnimalState> > dictionary10;

            if (this.AnimalTable.DesireTargetStateTable.TryGetValue(animalType, out dictionary9) && dictionary9.TryGetValue(breedingType, out dictionary10))
            {
                foreach (KeyValuePair <DesireType, List <AnimalState> > keyValuePair in dictionary10)
                {
                    List <AnimalState> animalStateList = new List <AnimalState>();
                    foreach (AnimalState animalState in keyValuePair.Value)
                    {
                        animalStateList.Add(animalState);
                    }
                    this.TargetStateTable[keyValuePair.Key] = animalStateList;
                }
            }
            Dictionary <BreedingTypes, Dictionary <DesireType, Dictionary <bool, Dictionary <DesireType, ChangeParamState> > > > dictionary11;
            Dictionary <DesireType, Dictionary <bool, Dictionary <DesireType, ChangeParamState> > > dictionary12;

            if (!this.AnimalTable.DesireResultTable.TryGetValue(animalType, out dictionary11) || !dictionary11.TryGetValue(breedingType, out dictionary12))
            {
                return;
            }
            foreach (KeyValuePair <DesireType, Dictionary <bool, Dictionary <DesireType, ChangeParamState> > > keyValuePair1 in dictionary12)
            {
                this.ResultTable[keyValuePair1.Key] = new Dictionary <bool, Dictionary <DesireType, ChangeParamState> >();
                foreach (KeyValuePair <bool, Dictionary <DesireType, ChangeParamState> > keyValuePair2 in keyValuePair1.Value)
                {
                    this.ResultTable[keyValuePair1.Key][keyValuePair2.Key] = new Dictionary <DesireType, ChangeParamState>();
                    foreach (KeyValuePair <DesireType, ChangeParamState> keyValuePair3 in keyValuePair2.Value)
                    {
                        this.ResultTable[keyValuePair1.Key][keyValuePair2.Key][keyValuePair3.Key] = keyValuePair3.Value;
                    }
                }
            }
        }