/** * 这个类只给PlayerAnimControl调用,其他类想调用动画去找PlayerAnimCotrol * **/ cc.Class({ extends: cc.Component, properties: { ArmatureDisPlay:null, }, start () { }, /** * @param PlayTimes * // * -1 为使用配置文件中的次数。 // * 0 为无限循环播放。 // * >0 为动画的重复次数。 */ PlayAnimationByName:function (AnimationName,PlayTimes) { // cc.log(AnimationName,'播放动画的名字'); this.ArmatureDisPlay.playAnimation(AnimationName, PlayTimes); }, //闲置等待动画 PlayIdleAnim:function(){ this.PlayAnimationByName("FemaleAwait",0); }, //跑步动画。其中SpeedLevel为速度等级,范围为1-6的int型,SpeedLevel越大,速度越快 PlayFemaleRunAnim:function(SpeedLevel,PlayTimes){ var b = SpeedLevel-2; if(SpeedLevel==1){ this.PlayAnimationByName("FemaleRun",PlayTimes); // this.ArmatureDisPlay.timeScale = 0.6; }else if(SpeedLevel==2){ this.PlayAnimationByName("FemaleRunFast",PlayTimes); // this.ArmatureDisPlay.timeScale = 0.7; }else if(SpeedLevel>2 && SpeedLevel<=6){ this.PlayAnimationByName("FemaleRunFast"+b,PlayTimes); // this.ArmatureDisPlay.timeScale = 0.8; }else if(SpeedLevel>6){ this.PlayAnimationByName("FemaleRunFast4",PlayTimes); // this.ArmatureDisPlay.timeScale = 1; } }, //跑步时摔倒动画 PlayFemaleFallAnim:function(){ this.PlayAnimationByName("FemaleFall1",1); }, //跳远的起跳 PlayLongJumpUpAnim:function(){ this.PlayAnimationByName("FemaleJump",1); }, //跳远的落地 PlayLongJumpDownAnim:function(){ this.PlayAnimationByName("FemaleDown",1); }, //跨栏动作 PlayHurdleJumpAnim:function(){ this.PlayAnimationByName("FemaleSpan",1); }, //拿着标枪跑步的动画。其中SpeedLevel为速度等级,范围为1-6的int型,SpeedLevel越大,速度越快 PlayJavelinRunAnim:function(SpeedLevel,PlayTimes){ if(SpeedLevel==1){ this.PlayAnimationByName("FemaleJavRun",PlayTimes); }else if(SpeedLevel==2){ this.PlayAnimationByName("FemaleJavFast",PlayTimes); }else if(SpeedLevel>2 && SpeedLevel<=6){ var b = SpeedLevel-2; this.PlayAnimationByName("FemaleJavFast"+b,PlayTimes); }else if(SpeedLevel>6){ this.PlayAnimationByName("FemaleJavFast4",PlayTimes); } }, //拿标枪时摔倒 PlayJavelinFallAnim:function(){ this.PlayAnimationByName("FemaleJavFall1",1); }, //扔出标枪动作 PlayJavelinOutAnim:function(){ this.PlayAnimationByName("FemaleJavOut",1); }, //跳上大象的动作 PlayUpElephantAnim:function(){ this.PlayAnimationByName("FAnimalUp",1); }, //骑大象跑的动画。其中SpeedLevel为速度等级,范围为1-6的int型,SpeedLevel越大,速度越快 PlayRideElephantRunAnim:function(SpeedLevel,PlayTimes){ if(SpeedLevel==1){ this.PlayAnimationByName("FAnimalRun",PlayTimes); }else if(SpeedLevel==2){ this.PlayAnimationByName("FAnimalRunFast",PlayTimes); }else if(SpeedLevel>2 && SpeedLevel<=6){ var b = SpeedLevel-2; this.PlayAnimationByName("FAnimalRunFast"+b,PlayTimes); }else if(SpeedLevel>6){ this.PlayAnimationByName("FAnimalRunFast4",PlayTimes); } }, //角色跳下大象的动作 PlayElephantOutAnim:function(){ this.PlayAnimationByName("FAnimalOut",1); }, //骑大象时踉跄 PlayElephantFallAnim:function(){ this.PlayAnimationByName("FAnimalFall",1); }, /** * 以下动画骨骼为Jav * **/ //标枪在空中飞的动作 PlayJavelinFlyAnim:function(){ this.PlayAnimationByName("JavFly",1); }, //标枪落地的动作 PlayJavelinDownAnim:function(){ this.PlayAnimationByName("JavEND",1); }, /** * 以下动画骨骼为Mammoth * **/ //大象慢跑 PlayElephantRunAnim:function () { this.PlayAnimationByName("MammothRun",0); }, //动画列表,备用 SetAnimationsNameArr:function(){ this.AnimationsNameArr=[ //跑步 //0 "FemaleAwait", //1 "FemaleRun", // 2 "FemaleRunFast", // 3 "FemaleRunFast1", // 4 "FemaleRunFast2", // 5 "FemaleRunFast3", // 6 "FemaleRunFast4", // 7 "FemaleFall1", //跳远 // 8 "FemaleJump", // 9 "FemaleDown", //跨栏 // 10 "FemaleSpan", //标枪 // 11 "FemaleJavRun", // 12 "FemaleJavFast", // 13 "FemaleJavFast1", // 14 "FemaleJavFast2", // 15 "FemaleJavFast3", // 16 "FemaleJavFast4", // 17 "FemaleJavOut", // 18 "JavFly", // 19 "JavEND", // 20 "FemaleJavFall1", //骑大象 // 21 "FAnimalUp", // 22 "MammothAwait", // 23 "FAnimalRun", // 24 "FAnimalRunFast", // 25 "FAnimalRunFast1", // 26 "FAnimalRunFast2", // 27 "FAnimalRunFast3", // 28 "FAnimalRunFast4", // 29 "FAnimalFall", // 30 "FAnimalOut", ] }, });