예제 #1
0
 public GroupStats(Society society)
 {
     soc           = society;
     sortedExps    = new int[soc.GetNumOfExps()];
     numToSort     = 0;
     nodeFound     = false;
     bumped        = null;
     numExpPerType = new int[soc.geneMap.Length, (int)Mathf.Pow(GeneValues.NUM_BASE_TYPES, soc.NUM_BASES_PER_GENE)];
     for (int i = 0; i < numExpPerType.GetLength(0); i++)
     {
         for (int j = 0; j < numExpPerType.GetLength(1); j++)
         {
             numExpPerType [i, j] = 0;
         }
     }
 }
    public bool CanTrigger()
    {
        if (!repeatable && triggered)
        {
            return(false);
        }
        if (onNumExps && numExpsInSociety != society.GetNumOfExps())
        {
            return(false);
        }
        if (exp != null)
        {
            if (!EqualIfNotNull(expState, exp.GetState(), checkExp))
            {
                return(false);
            }
            //if (!EqualIfNotNull (expAnimState, ...
        }
        if (!EqualIfNotNull(socState, society.GetState(), checkSoc))
        {
            return(false);
        }
        print(onAttack + "  " + (!society.ExpsAreAttackingEachOther()));
        if (onAttack && !society.ExpsAreAttackingEachOther())
        {
            return(false);
        }
        if (onFactoryExp && onFilledGenes && !society.GetExpWithId(-1).dna.HasFilledGenes())
        {
            return(false);
        }
        if (onSameGenes && !society.GetExpWithId(-1).dna.SameTypeOfExp(expGeneMap))
        {
            return(false);
        }

        if (onSocietyCompletion && !society.GetState().Equals(Society.SocState.Finished))
        {
            return(false);
        }
        triggered = true;
        return(true);
    }