Exemple #1
0
        private FunctionPrototype GenerateFunctionPrototype(GenericModifier modifier)
        {
            Assert.AssertTypeMatch(parser.LastToken, TokenType.Fun);
            var prototype = new FunctionPrototype();

            prototype.Modifier = modifier;
            parser.ProceedToken(); // fun を消費

            Assert.AssertTypeMatch(parser.LastToken, TokenType.Identifier);
            prototype.FunctionName = parser.LastToken.Value;
            parser.ProceedToken(); // 関数名を消費

            prototype.args = GenerateArgs();

            // TODO 戻り値

            parser.ProceedToken(); // : を消費

            return(prototype);
        }
Exemple #2
0
        public GenericModifier GenerateModifier()
        {
            var modifier = new GenericModifier();

            while (parser.LastToken.TokenType.IsIn(Modifiers))
            {
                switch (parser.LastToken.TokenType)
                {
                case TokenType.Accessibility:
                    modifier.Accessibility = parser.LastToken.Value.ConvertToAccessibility();
                    break;

                case TokenType.Static:
                    modifier.Static = "static";
                    break;
                }
                parser.ProceedToken();
            }
            return(modifier);
        }
Exemple #3
0
        private ClassPrototypeAST GenerateClassPrototype(GenericModifier modifier)
        {
            var prototype = new ClassPrototypeAST
            {
                Modifier  = modifier,
                Namespace = _currentNamespace
            };


            this.ProceedToken(); // class を消費

            prototype.ClassName = this.LastToken.Value;
            this.ProceedToken(); // クラス名を消費

            // TODO inheritence

            this.ProceedToken(); // :を消費

            return(prototype);
        }
    public override void Initialize(GameObject obj)
    {
        base.Initialize(obj);

        //Adds a particle system to the Encounter GameObject
        //Edits the rate of emission and the particle lifetimes
        obj.AddComponent <ParticleSystem>();
        var em = obj.GetComponent <ParticleSystem>().emission;

        em.rateOverTime = 200;
        var main = obj.GetComponent <ParticleSystem>().main;

        main.startLifetime = 1;

        obj.GetComponent <ParticleSystemRenderer>().material = encounterMaterial;

        //Finds player for Encounter functions
        _player = FindObjectOfType <PlayerInput>().gameObject;

        RUNTIME_MOD = Instantiate(modifier);
        RUNTIME_MOD.Initialize(null);
    }
Exemple #5
0
        public IEnumerable <ASTBase> Parse()
        {
            var asts = new List <ASTBase>();

            while (_tokenReader.HasNext)
            {
                this.ProceedToken();

                switch (this.LastToken.TokenType)
                {
                case TokenType.Using:
                    this.ProceedToken();     // using をスキップ
                    _usings.Add(this.LastToken.Value);
                    continue;

                case TokenType.Namespace:
                    this.ProceedToken();     // namespace をスキップ
                    _currentNamespace = this.LastToken.Value;
                    this.ProceedToken();     // : を消費すように一個ずらす
                    continue;
                }

                GenericModifier   modifier  = _modifierGenerator.GenerateModifier();
                ClassPrototypeAST prototype = this.GenerateClassPrototype(modifier);
                ClassAST          classAst  = this.GenerateClassAST(prototype);

                asts.Add(classAst);

                if (this.LastToken.TokenType == TokenType.BlockEnd)
                {
                    break;
                }
            }

            return(asts);
        }
Exemple #6
0
 private void Start()
 {
     RUNTIME_MOD = Instantiate(ThornModConfig);
     RUNTIME_MOD.Initialize(null);
 }
 public override void Initialize(GameObject obj)
 {
     _owner    = obj;
     healthMod = Instantiate(healthMod);
 }
 public void Initialize()
 {
     RUNTIME_MOD = Instantiate(ThornModConfig);
     RUNTIME_MOD.Initialize(null);
 }
Exemple #9
0
 public override void Initialize(GameObject obj)
 {
     base.Initialize(obj);
     healthMod = Instantiate(healthMod);
     healthMod.Initialize(obj);
 }