예제 #1
0
    public override void LoadModel()
    {
        string modelPath = "Resources/" + J_ModelResource.GetData(towerInfo.towerData._modelId)._modelPath;

        towerAsset = GameLoader.Instance.LoadAssetSync(modelPath);
        towerObj   = towerAsset.GameObjectAsset;
        towerObj.transform.position = this.towerInfo.GetPosition();
        //增加点击事件
        AddClickInfo(towerObj, towerInfo.Id);
        //加载塔身图片
        GameObject towerBaseObj = towerObj.transform.Find("ArrowTowerBase").gameObject;

        towerBase = InitSpriteImage(towerBaseObj, towerInfo.towerBase);
        //加载射手1
        GameObject shooterObj1 = towerObj.transform.Find("ArrowShooter1").gameObject;

        shooter1 = InitAnimate(shooterObj1, towerInfo.shooter);
        //加载射手2
        GameObject shooterObj2 = towerObj.transform.Find("ArrowShooter2").gameObject;

        shooter2 = InitAnimate(shooterObj2, towerInfo.shooter);

        bulletPos1 = towerObj.transform.Find("BulletPos1").position;
        bulletPos2 = towerObj.transform.Find("BulletPos2").position;
        //根据塔基座大小增加碰撞盒
        //AddBoxColider(towerObj, towerBase.width, towerBase.height);
    }
예제 #2
0
    public override void LoadModel()
    {
        string modelPath = "Resources/" + J_ModelResource.GetData(towerInfo.towerData._modelId)._modelPath;

        towerAsset = GameLoader.Instance.LoadAssetSync(modelPath);
        towerObj   = towerAsset.GameObjectAsset;
        towerObj.transform.position = this.towerInfo.GetPosition();
        bulletPos = towerObj.transform.Find("BulletPos1").position;
        //增加点击事件
        AddClickInfo(towerObj, towerInfo.Id);
        //加载塔身图片
        towerBase = InitAnimate(towerObj, towerInfo.towerBase);

        //根据塔基座大小增加碰撞盒
        //AddBoxColider(towerObj, 80, 70);
    }