Beispiel #1
0
    public override void Init()
    {
        puppet = GetComponentInChildren <PuppetMaster>();
        if (!puppet.initiated)
        {
            puppet.Initiate();
        }
        actorController.Init(this);
        actorParts = actorController.GetActorParts();
        Global.Tranverse(actorParts.puppetRoot, EnableCols);
        if (controlling)
        {
            cameraHandler.am = this;
            var gm = GetGM();
            gm.AddEvent("Move", (InputManager.Value2)actorController.Move);
            gm.AddEvent("View", (InputManager.Value2)actorController.View);
            gm.AddEvent("Defence", (InputManager.Bool1)actorController.Defence);
            gm.AddEvent("Attack", (InputManager.Bool1)actorController.Attack);
            gm.AddEvent("View", (InputManager.Value2)cameraHandler.View);
            gm.AddEvent("AdRange", (InputManager.Value1)actorController.AdRange);
            gm.AddEvent("Run", (InputManager.Bool1)actorController.Run);
            gm.AddEvent("Dodge", (InputManager.Value0)actorController.Dodge);
            gm.AddEvent("Jump", (InputManager.Value1)actorController.Jump);
            gm.AddEvent("PickDrop", (InputManager.Bool1)actorController.PickDrop);
            gm.AddEvent("Skill", (InputManager.Value0)actorController.Skill);
        }
        else
        {
        }

        state = gameObject.GetComponent <StateController>();
        if (state == null)
        {
            state = gameObject.AddComponent <StateController>();
        }
        state.Init(this);

        if (skillController == null)
        {
            skillController = gameObject.AddComponent <SkillController>();
        }
        skillController.Init(actorParts);


        // SubManager初始化
        battleMng = GetComponent <SubBattleManager>();
        if (battleMng == null)
        {
            battleMng = gameObject.AddComponent <SubBattleManager>();
        }
        effectMng = GetComponent <SubEffectManager>();
        if (effectMng == null)
        {
            effectMng = gameObject.AddComponent <SubEffectManager>();
        }

        battleMng.Init();
        effectMng.Init();

        LateInit();

        // 测试代码位置
        // TODO 删除 test代码
        Test();
    }