public void SetProbability(MZFormation.SizeType type, int probability) { MZDebug.Assert( _probabilitiesDictionary != null, "why _probabilitiesDictionary is null???" ); if( _probabilitiesDictionary.ContainsKey( type ) == false ) _probabilitiesDictionary.Add( type, 0 ); _probabilitiesDictionary[ type ] = probability; _probabilitiesDenominator = 0; foreach( int p in _probabilitiesDictionary.Values ) _probabilitiesDenominator += p; }
public void AddFormation(SizeType sizeType, PositionType positionType, MZFormation formation) { if( _formationsBySizeDictionary == null ) _formationsBySizeDictionary = new Dictionary<SizeType, Dictionary<PositionType, List<MZFormation>>>(); if( _formationsBySizeDictionary.ContainsKey( sizeType ) == false ) { Dictionary<PositionType, List<MZFormation>> newDic = new Dictionary<PositionType, List<MZFormation>>(); _formationsBySizeDictionary.Add( sizeType, newDic ); } if( _formationsBySizeDictionary[ sizeType ].ContainsKey( positionType ) == false ) { List<MZFormation> newList = new List<MZFormation>(); _formationsBySizeDictionary[ sizeType ].Add( positionType, newList ); } formation.sizeType = sizeType; formation.positionType = positionType; _formationsBySizeDictionary[ sizeType ][ positionType ].Add( formation ); }
public MZTestFormationSetting(MZFormation formation) { MZDebug.Assert( formation != null, "formation is null" ); constructCode = formation.constructCode; name = formation.GetType().ToString(); sizeType = formation.sizeType; positionType = formation.positionType; }
void ExecuteFormation(MZFormation formation) { MZDebug.Assert( formation != null, "formation is null" ); if( _currentFormationsList == null ) { _currentFormationsList = new List<MZFormation>(); } if( _currentFormationsList.Contains( formation ) == false ) { if( formation.positionType == PositionType.Any ) ResetPositionTypeOrder(); formation.rank = rankControl.enemyRank; formation.Enable(); _currentFormationsList.Add( formation ); if( MZGameSetting.SHOW_FORMATION_LOG ) MZDebug.Log( "add: name={0}, xp={1}, pos={2}, size={3}", formation.ToString(), formation.stateExp, formation.positionType, formation.sizeType ); _currentFormationState.exp += formation.stateExp; rankControl.enemyRankXp += 1; } else { ResetPositionTypeOrder(); } }