public void ComplexPatternSpeciesInDifferentOrder()
    {
        MoleculeDef moleculeDef1 = Resources.Load("Tests/Molecules/A test") as MoleculeDef;

        ComponentPattern[] components1 = new ComponentPattern[3];
        components1[0] = new ComponentPattern("a", "0", false);
        components1[1] = new ComponentPattern("b", "0", false);
        components1[2] = new ComponentPattern("c", "0", false);
        MoleculePattern pattern1 = new MoleculePattern(moleculeDef1, components1);

        MoleculeDef moleculeDef2 = Resources.Load("Tests/Molecules/B test") as MoleculeDef;

        ComponentPattern[] components2 = new ComponentPattern[3];
        components2[0] = new ComponentPattern("a", "0", false);
        components2[1] = new ComponentPattern("b", "0", false);
        components2[2] = new ComponentPattern("c", "0", false);
        MoleculePattern pattern2 = new MoleculePattern(moleculeDef2, components2);

        ComplexPattern complexPattern1 = new ComplexPattern(new MoleculePattern[] { pattern1, pattern2 });
        ComplexPattern complexPattern2 = new ComplexPattern(new MoleculePattern[] { pattern2, pattern1 });

        if (debug)
        {
            Debug.Log("ComplexPatternSpeciesInDifferentOrder: " + complexPattern1.GetHashCode() + " != " + complexPattern2.GetHashCode()
                      + " ? " + complexPattern1.Equals(complexPattern2));
        }

        Assert.IsTrue(HashCodesMatchEquals(complexPattern1, complexPattern2));
    }
예제 #2
0
    // Start is called before the first frame update
    void Start()
    {
        ComplexPattern _ = new ComplexPattern();

        _.actions = new Queue <BulletActionNode>();

        _.actions.Enqueue(new Fire(-10f));
        _.actions.Enqueue(new Delay(0.2f));
        _.actions.Enqueue(new Fire(-5f));
        _.actions.Enqueue(new Delay(0.2f));
        _.actions.Enqueue(new Fire(0f));
        _.actions.Enqueue(new Delay(0.2f));
        _.actions.Enqueue(new Fire(5f));
        _.actions.Enqueue(new Delay(0.2f));
        _.actions.Enqueue(new Fire(10f));
        _.actions.Enqueue(new Delay(0.2f));
        _.actions.Enqueue(new Fire(5f));
        _.actions.Enqueue(new Delay(0.2f));
        _.actions.Enqueue(new Fire(0f));
        _.actions.Enqueue(new Delay(0.2f));
        _.actions.Enqueue(new Fire(-5f));
        _.actions.Enqueue(new Delay(0.2f));
        _.actions.Enqueue(new Fire(-10f));
        _.actions.Enqueue(new Delay(0.2f));


        /*
         * _.actions.Enqueue( new Fire( -10f ) );
         * _.actions.Enqueue( new Fire( 0f ) );
         * _.actions.Enqueue( new Fire( 10f ) );
         * _.actions.Enqueue( new Delay( 0.5f ) );
         * _.actions.Enqueue( new Fire( -7f ) );
         * _.actions.Enqueue( new Fire( 7f ) );
         * _.actions.Enqueue( new Delay( 0.5f ) );
         */
        _.projectileSpeed = 0.05f;
        bp            = _;
        bp.spawnPoint = spawnPoint;
        bp.bullet     = bullet;
        bp.side       = side;
    }