コード例 #1
0
    public void AddTowerByData()
    {
        PathInfo towerPosInfo = pathLoader.GetPath("Tower");
        int      count        = towerPosInfo.GetCount();

        for (int i = 0; i < count; i++)
        {
            Vector3   pos   = towerPosInfo.GetPoint(i);
            TowerInfo tower = EntityManager.getInstance().AddTower(100);
            tower.SetPosition(pos.x, pos.y, 0);
            tower.ChangeState("idle");
        }
    }
コード例 #2
0
ファイル: Test1.cs プロジェクト: pixar2016/Assets
    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");
    }