public void generateFactory(string pathString, StateClassGenerator stateClassGenerator)
        {
            string copyPath = pathString + "BehaviourStateFactory.cs";

            Debug.Log("Creating Classfile: " + copyPath);
            if (!File.Exists(copyPath))
            {
                addNewFactory(copyPath, stateClassGenerator);
            }
            else
            {
            }
        }
        private void addNewFactory(string copyPath, StateClassGenerator stateClassGenerator)
        {
            using (StreamWriter outfile =
                       new StreamWriter(copyPath))
            {
                outfile.WriteLine("using GameLib.Entity.Behaviour;");
                outfile.WriteLine("using " + stateClassGenerator.NameOfNamespace + ".Entity.Behaviour.State;");
                outfile.WriteLine("");

                outfile.WriteLine("namespace " + stateClassGenerator.NameOfNamespace + ".Entity.Behaviour");
                outfile.WriteLine("{");

                outfile.WriteLine("\tpublic class BehaviourStateFactory : GameLib.Entity.Behaviour.BehaviourStateFactory");

                outfile.WriteLine("\t{");

                if (stateClassGenerator.PlayerStateIdle)
                {
                    addStateCreationFunction(outfile, "Idle");
                }
                if (stateClassGenerator.PlayerStateAttack)
                {
                    addStateCreationFunction(outfile, "Attack");
                }
                if (stateClassGenerator.PlayerStateDeath)
                {
                    addStateCreationFunction(outfile, "Death");
                }
                if (stateClassGenerator.PlayerStateFall)
                {
                    addStateCreationFunction(outfile, "Fall");
                }
                if (stateClassGenerator.PlayerStateHit)
                {
                    addStateCreationFunction(outfile, "Hit");
                }
                if (stateClassGenerator.PlayerStateJumpUp)
                {
                    addStateCreationFunction(outfile, "JumpUp");
                }
                if (stateClassGenerator.PlayerStateMove)
                {
                    addStateCreationFunction(outfile, "Move");
                }

                outfile.WriteLine("\t}");
                outfile.WriteLine("}");
            }//File written
        }
示例#3
0
        private void generateStateAssets(string pathString)
        {
            StateClassGenerator stateClassGenerator = new StateClassGenerator();

            stateClassGenerator.NameOfNamespace   = NameOfNamespace;
            stateClassGenerator.PlayerStateAttack = playerStateAttack;
            stateClassGenerator.PlayerStateDeath  = playerStateDeath;
            stateClassGenerator.PlayerStateFall   = playerStateFall;
            stateClassGenerator.PlayerStateHit    = playerStateHit;
            stateClassGenerator.PlayerStateIdle   = playerStateIdle;
            stateClassGenerator.PlayerStateJumpUp = playerStateJumpUp;
            stateClassGenerator.PlayerStateMove   = playerStateMove;

            BehaviourStateFactoryGenerator behaviourStateFactoryGenerator = new BehaviourStateFactoryGenerator();

            pathString = behaviourStateFactoryGenerator.generateFolderForBehaviourStateFactory(pathString);
            behaviourStateFactoryGenerator.generateFactory(pathString, stateClassGenerator);

            pathString = stateClassGenerator.generateFolderForStates(pathString);
            stateClassGenerator.generateStates(pathString, false);
        }
 private void addNewMethodes(string copyPath, StateClassGenerator stateClassGenerator)
 {
 }