Ejemplo n.º 1
0
    void Start()
    {
        J_Map.LoadConfig();
        J_Creature.LoadConfig();
        J_SkillEvent.LoadConfig();
        J_Skill.LoadConfig();
        J_Tower.LoadConfig();
        J_AnimData.LoadConfig();
        J_Effect.LoadConfig();
        J_ModelResource.LoadConfig();

        EntityManager.getInstance();
        EntityViewManager.getInstance();

        //DataPreLoader.getInstance().LoadData("Monsters");
        //根据图片信息txt将图片里帧信息分离出来
        //SpriteFrameCache.getInstance().addSpriteFrameFromFile("Resources/Config/monster1.txt");
        SpriteFrameCache.getInstance().addSpriteFrameFromFile("Resources/Config/Helper.txt");
        SpriteFrameCache.getInstance().addSpriteFrameFromFile("Resources/Config/Monster1.txt");
        SpriteFrameCache.getInstance().addSpriteFrameFromFile("Resources/Config/Monster2.txt");
        SpriteFrameCache.getInstance().addSpriteFrameFromFile("Resources/Config/Solider1.txt");
        SpriteFrameCache.getInstance().addSpriteFrameFromFile("Resources/Config/Tower1.txt");
        SpriteFrameCache.getInstance().addSpriteFrameFromFile("Resources/Config/TowerShooter.txt");
        AnimationCache animCache = AnimationCache.getInstance();

        List <D_AnimData> animList = J_AnimData.ToList();
        int count = animList.Count;

        for (int i = 0; i < count; i++)
        {
            D_AnimData animData = animList[i];
            bool       loop     = (animData._loop == 1?true:false);
            //无动作动画
            if (animData._animName == "")
            {
                animCache.addAnimation(
                    animCache.createAnimation(animData._FrameName, animData._startFrame, animData._endFrame, animData._delta, loop, animData._xoffset, animData._yoffset),
                    animData._modelName
                    );
            }
            else
            {
                animCache.addAnimation(
                    animCache.createAnimation(animData._FrameName, animData._startFrame, animData._endFrame, animData._delta, loop, animData._xoffset, animData._yoffset),
                    animData._modelName,
                    animData._animName
                    );
            }
        }

        GameObject uiroot = GameObject.Find("Canvas").gameObject;

        UiManager.Instance.Init(uiroot);

        PathLoader pathloader = new PathLoader();

        pathloader.LoadPath("level1");
        PathInfo path = pathloader.GetPath("1");

        //path.PrintAllPoint();


        //charInfo.ChangeState("move");
        BattleFingerEvent.getInstance().ChangeState("start");
        //tower = EntityManager.getInstance().AddTower(100);
        //tower.SetPosition(0, 0, 0);
        //tower.ChangeState("idle");
        //CharacterInfo charInfo = EntityManager.getInstance().AddSolider(50001);
        //charInfo.SetPosition(0, 0, 0);
        //monster = EntityManager.getInstance().AddMonster(10001, path);
        //monster.SetPosition(0, 0, 0);
        //tower = EntityManager.getInstance().AddTower(11);
        //tower.SetPosition(0, 0, 0);
        //tower.ChangeState("idle");
        //tower = EntityManager.getInstance().AddTower(12);
        //tower.SetPosition(0, 0, 0);
        //tower.ChangeState("idle");
        //tower = EntityManager.getInstance().AddTower(13);
        //tower.SetPosition(0, 0, 0);
        //tower.ChangeState("idle");
        tower = EntityManager.getInstance().AddTower(15);
        tower.SetPosition(0, 0, 0);
        tower.ChangeState("idle");
        //tower = EntityManager.getInstance().AddTower(15);
        //tower.SetPosition(0, 0, 0);
        //tower.ChangeState("idle");

        baseEffect = EntityManager.getInstance().AddStaticEffect(17, Vector3.zero);


        //GameManager.getInstance().LoadLevel(1);
        //GameManager.getInstance().StartGame();

        monster = EntityManager.getInstance().AddMonster(10001, path);
        monster.SetPosition(100, 5, 0);
        //monster = EntityManager.getInstance().AddMonster(10001, path);
        //monster.SetPosition(250, 0, 0);
        //monster.SetPosition(116, -100, 0);
        //monster.ChangeState("move");

        //CharacterInfo charInfo = EntityManager.getInstance().AddSolider(50001);
        //charInfo.SetPosition(-180, -150, 0);
        //charInfo.DoAction("idle");
        //charInfo = EntityManager.getInstance().AddSolider(50001);
        //charInfo.SetPosition(-170, -150, 0);
        //charInfo.DoAction("idle");
    }
Ejemplo n.º 2
0
    void Start()
    {
        EntityManager.getInstance();
        EntityViewManager.getInstance();

        //DataPreLoader.getInstance().LoadData("Monsters");
        //根据图片信息txt将图片里帧信息分离出来
        //SpriteFrameCache.getInstance().addSpriteFrameFromFile("Resources/Config/monster1.txt");
        SpriteFrameCache.getInstance().addSpriteFrameFromFile("Resources/Config/Helper.txt");
        SpriteFrameCache.getInstance().addSpriteFrameFromFile("Resources/Config/Monster1.txt");
        SpriteFrameCache.getInstance().addSpriteFrameFromFile("Resources/Config/Monster2.txt");
        SpriteFrameCache.getInstance().addSpriteFrameFromFile("Resources/Config/Solider1.txt");
        SpriteFrameCache.getInstance().addSpriteFrameFromFile("Resources/Config/Tower1.txt");
        SpriteFrameCache.getInstance().addSpriteFrameFromFile("Resources/Config/TowerShooter.txt");
        AnimationCache animCache = AnimationCache.getInstance();

        //第一个参数 createAnimation(参数1-图片名字 参数2-图片开始序号 参数3-图片结束序号 参数4-动画间隔 参数5-是否循环)
        //第二个参数 动画名称
        //第三个参数 动作名称
        animCache.addAnimation(animCache.createAnimation("wulf_", 19, 19, 0.1f, true), "wulf", "idle");
        animCache.addAnimation(animCache.createAnimation("wulf_", 1, 8, 0.1f, true), "wulf", "run1");
        animCache.addAnimation(animCache.createAnimation("wulf_", 9, 18, 0.1f, true), "wulf", "run2");
        animCache.addAnimation(animCache.createAnimation("wulf_", 19, 28, 0.1f, false), "wulf", "attack");
        animCache.addAnimation(animCache.createAnimation("wulf_", 29, 35, 0.1f, false), "wulf", "stuck_start");
        animCache.addAnimation(animCache.createAnimation("wulf_", 35, 40, 0.1f, false), "wulf", "stuck_end");
        animCache.addAnimation(animCache.createAnimation("wulf_", 41, 49, 0.1f, false), "wulf", "die");

        animCache.addAnimation(animCache.createAnimation("knight_", 1, 1, 0.1f, true), "knight", "idle");
        animCache.addAnimation(animCache.createAnimation("knight_", 2, 6, 0.1f, true), "knight", "run1");
        animCache.addAnimation(animCache.createAnimation("knight_", 7, 10, 0.1f, false), "knight", "attack");
        animCache.addAnimation(animCache.createAnimation("knight_", 11, 15, 0.1f, false), "knight", "attack1");
        animCache.addAnimation(animCache.createAnimation("knight_", 16, 33, 0.1f, false), "knight", "skill1");
        animCache.addAnimation(animCache.createAnimation("knight_", 34, 62, 0.1f, false), "knight", "skill2");
        animCache.addAnimation(animCache.createAnimation("knight_", 63, 69, 0.1f, false), "knight", "die");
        //箭塔
        animCache.addAnimation(animCache.createAnimation("arrowTowerlv1Shooter_", 1, 1, 0.1f, false), "arrowTowerlv1Shooter", "idle");
        animCache.addAnimation(animCache.createAnimation("arrowTowerlv1Shooter_", 1, 5, 0.1f, false), "arrowTowerlv1Shooter", "attack");
        animCache.addAnimation(animCache.createAnimation("arrowTowerlv1Shooter_", 6, 10, 0.1f, false), "arrowTowerlv1Shooter", "attack1");
        animCache.addAnimation(animCache.createAnimation("arrowTowerlv2Shooter_", 1, 1, 0.1f, false), "arrowTowerlv2Shooter", "idle");
        animCache.addAnimation(animCache.createAnimation("arrowTowerlv2Shooter_", 1, 5, 0.1f, false), "arrowTowerlv2Shooter", "attack");
        animCache.addAnimation(animCache.createAnimation("arrowTowerlv2Shooter_", 6, 10, 0.1f, false), "arrowTowerlv2Shooter", "attack1");
        animCache.addAnimation(animCache.createAnimation("arrowTowerlv3Shooter_", 1, 1, 0.1f, false), "arrowTowerlv3Shooter", "idle");
        animCache.addAnimation(animCache.createAnimation("arrowTowerlv3Shooter_", 1, 5, 0.1f, false), "arrowTowerlv3Shooter", "attack");
        animCache.addAnimation(animCache.createAnimation("arrowTowerlv3Shooter_", 6, 10, 0.1f, false), "arrowTowerlv3Shooter", "attack1");
        //兵营
        animCache.addAnimation(animCache.createAnimation("barrackTowerlv1_", 1, 1, 0.1f, false), "barrackTowerlv1", "idle");
        animCache.addAnimation(animCache.createAnimation("barrackTowerlv1_", 2, 4, 0.1f, false), "barrackTowerlv1", "start");
        animCache.addAnimation(animCache.createAnimation("barrackTowerlv2_", 1, 1, 0.1f, false), "barrackTowerlv2", "idle");
        animCache.addAnimation(animCache.createAnimation("barrackTowerlv2_", 2, 4, 0.1f, false), "barrackTowerlv2", "start");
        animCache.addAnimation(animCache.createAnimation("barrackTowerlv3_", 1, 1, 0.1f, false), "barrackTowerlv3", "idle");
        animCache.addAnimation(animCache.createAnimation("barrackTowerlv3_", 2, 4, 0.1f, false), "barrackTowerlv3", "start");
        //魔法塔
        animCache.addAnimation(animCache.createAnimation("mageTowerlv1_", 1, 1, 0.1f, false), "mageTowerlv1", "idle");
        animCache.addAnimation(animCache.createAnimation("mageTowerlv1_", 2, 6, 0.1f, false), "mageTowerlv1", "attack");
        animCache.addAnimation(animCache.createAnimation("mageTowerlv2_", 1, 1, 0.1f, false), "mageTowerlv2", "idle");
        animCache.addAnimation(animCache.createAnimation("mageTowerlv2_", 2, 6, 0.1f, false), "mageTowerlv2", "attack");
        animCache.addAnimation(animCache.createAnimation("mageTowerlv3_", 1, 1, 0.1f, false), "mageTowerlv3", "idle");
        animCache.addAnimation(animCache.createAnimation("mageTowerlv3_", 2, 6, 0.1f, false), "mageTowerlv3", "attack");
        animCache.addAnimation(animCache.createAnimation("mageTowerShooter_", 1, 1, 0.1f, false), "mageTowerShooter", "idle");
        animCache.addAnimation(animCache.createAnimation("mageTowerShooter_", 2, 2, 0.1f, false), "mageTowerShooter", "idle1");
        animCache.addAnimation(animCache.createAnimation("mageTowerShooter_", 3, 11, 0.1f, false), "mageTowerShooter", "attack");
        animCache.addAnimation(animCache.createAnimation("mageTowerShooter_", 12, 21, 0.1f, false), "mageTowerShooter", "attack1");
        animCache.addAnimation(animCache.createAnimation("mageTowerNecroShooter_", 1, 1, 0.1f, false), "mageTowerNecroShooter", "idle");
        animCache.addAnimation(animCache.createAnimation("mageTowerNecroShooter_", 2, 2, 0.1f, false), "mageTowerNecroShooter", "idle1");
        animCache.addAnimation(animCache.createAnimation("mageTowerNecroShooter_", 3, 15, 0.1f, false), "mageTowerNecroShooter", "attack");
        animCache.addAnimation(animCache.createAnimation("mageTowerNecroShooter_", 16, 28, 0.1f, false), "mageTowerNecroShooter", "attack1");
        animCache.addAnimation(animCache.createAnimation("mageTowerNecroShooter_", 29, 31, 0.1f, false), "mageTowerNecroShooter", "skill");
        animCache.addAnimation(animCache.createAnimation("mageTowerNecroShooter_", 32, 34, 0.1f, false), "mageTowerNecroShooter", "skill1");
        animCache.addAnimation(animCache.createAnimation("mageTowerMasterShooter_", 1, 1, 0.1f, false), "mageTowerMasterShooter", "idle");
        animCache.addAnimation(animCache.createAnimation("mageTowerMasterShooter_", 2, 2, 0.1f, false), "mageTowerMasterShooter", "idle1");
        animCache.addAnimation(animCache.createAnimation("mageTowerMasterShooter_", 3, 4, 0.1f, false), "mageTowerMasterShooter", "attack");
        animCache.addAnimation(animCache.createAnimation("mageTowerMasterShooter_", 5, 6, 0.1f, false), "mageTowerMasterShooter", "attack1");
        //弓箭特效
        animCache.addAnimation(animCache.createAnimation("arrow", 0, 0, 0.1f, true), "arrow");

        J_Map.LoadConfig();
        J_Creature.LoadConfig();
        J_SkillEvent.LoadConfig();
        J_Skill.LoadConfig();
        J_Tower.LoadConfig();

        GameObject uiroot = GameObject.Find("Canvas").gameObject;

        UiManager.Instance.Init(uiroot);

        //PathLoader pathloader = new PathLoader();
        //pathloader.LoadPath("level1");
        //PathInfo path = pathloader.GetPath("1");
        //path.PrintAllPoint();


        //charInfo.ChangeState("move");
        BattleFingerEvent.getInstance();
        tower = EntityManager.getInstance().AddTower(1);
        tower.SetPosition(250, 0, 0);
        tower.ChangeState("idle");
        GameManager.getInstance().LoadLevel(1);
        GameManager.getInstance().StartGame();
        //monster = EntityManager.getInstance().AddMonster(10002, path);
        //monster.SetPosition(-180, -150, 0);
    }