【身外化身剧情】孙悟空可配置为主角

dev_chengFeng
gaoxin 2021-12-10 11:58:42 +08:00
parent 836d216309
commit 9ec7d07fbb
2 changed files with 42 additions and 35 deletions

View File

@ -175,6 +175,7 @@ end
--获取怪物数据(战斗用)
function this.GetMonsterData(monsterId)
LogRed("GetMonsterData :"..monsterId)
local monsterConfig = MonsterConfig[monsterId]
return {
roleId = monsterConfig.MonsterId,
@ -676,11 +677,16 @@ function this.GetMonsterDataFromGroup(gId, camp)
list[i] = this.PokemonUnitAdapter(mUnit, camp)
end
end
-- 主角
-- 技能
local RoleSkills = MonsterGroup[gId].Role
if RoleSkills and #RoleSkills > 0 then
-- 主角ID
local CharacterId = MonsterGroup[gId].CharacterId
if not CharacterId or CharacterId == 0 then
CharacterId = 20100
end
local mUnit = {
unitId = 20100,
unitId = CharacterId,
position = 100,
star = 1,
playerSex = NameManager.roleSex,

View File

@ -29,26 +29,37 @@ function MonsterView:onCreate(go, role, position, root)
self.icon = Util.GetGameObject(go, "icon"):GetComponent("Image")
self.turnEffect=role.camp == 0 and self.RootPanel.lingshouDownEffect or self.RootPanel.lingshouUpEffect
-- 获取数据
local live=0
self.livePath = nil
if position==100 then
if role.sex==ROLE_SEX.BOY then
self.livePath="live2d_npc_boy"
else
self.livePath="live2d_npc_girl"
end
--self.livePath="live2d_npc_girl"
role.roleData.id=20100
else
self.livePath = GetResourcePath(SpiritAnimal[role.roleData.id].Live)
self.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(SpiritAnimal[role.roleData.id].Icon))
if not role.roleData.id or role.roleData.id == 0 then
role.roleData.id = 20100
end
if role.roleData.id == 20100 then
if role.sex == ROLE_SEX.BOY then
self.livePath = "live2d_npc_boy"
else
self.livePath = "live2d_npc_girl"
end
-- 确定是主角
self.isMainPlayer = true
end
end
self.play_liveScale = SpiritAnimal[role.roleData.id].play_liveScale
self.enemy_liveScale = SpiritAnimal[role.roleData.id].enemy_liveScale
self.offset = SpiritAnimal[role.roleData.id].offset
self.outOffset = SpiritAnimal[role.roleData.id].enemy_offset
self.spAtkTime = SpiritAnimal[role.roleData.id].CastingSkills/1000
self.atkSoundTime = SpiritAnimal[role.roleData.id].CastingAudio/1000
self.attackSound = SpiritAnimal[role.roleData.id].sond
-- 配置表数据
self.config = SpiritAnimal[role.roleData.id]
-- 如果不是男女主角
if not self.livePath then
self.livePath = GetResourcePath(self.config.Live)
self.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(self.config.Icon))
end
self.play_liveScale = self.config.play_liveScale
self.enemy_liveScale = self.config.enemy_liveScale
self.offset = self.config.offset
self.outOffset = self.config.enemy_offset
self.spAtkTime = self.config.CastingSkills/1000
self.atkSoundTime = self.config.CastingAudio/1000
self.attackSound = self.config.sond
-- 人物立绘
@ -139,12 +150,7 @@ function MonsterView:PlaySpineAnim(gog, time, name, isLoop)
local _complete = nil
_complete = function(state)
gog.AnimationState.Complete = gog.AnimationState.Complete - _complete
if self.role.roleData.id==20100 then
gog.AnimationState:SetAnimation(0, "idle", true)
else
gog.AnimationState:SetAnimation(0, "attack", true)
end
gog.AnimationState:SetAnimation(0, "idle", true)
end
gog.AnimationState:ClearTracks() -- 清除上一个动画的影响(修复概率攻击动画播放错误的问题)
gog.AnimationState:SetAnimation(time, name, isLoop)
@ -182,7 +188,7 @@ function MonsterView:OnSkillCastStart(skill)
self.RoleLiveGO3.transform:SetParent(self.skillCastRoot.gameObject.transform)
self.RoleLiveGO3.transform:SetSiblingIndex(0)
--self.RoleLiveGO3.transform.position=Vector3.zero
local offset = self.camp == 0 and SpiritAnimal[20100].offset or SpiritAnimal[20100].enemy_offset
local offset = self.camp == 0 and self.config.offset or self.config.enemy_offset
local add=roleConfig.enemy_offset
if self.camp==1 then
self.RoleLiveGO3.transform.rotation=Vector3.New(0,180,0)
@ -219,10 +225,6 @@ function MonsterView:OnSkillCastingStart(skill)
-- 提前进入下一阶段
self.turnEffect:SetActive(false)
self.RoleLiveGO2:SetActive(true)
local animName="attack"
if self.role.roleData.id==20100 then
animName="idle"
end
self.RoleLiveGO2:GetComponent("RectTransform").rotation = Quaternion.Euler(Vector3.New(0, 0, 0))
if self.RoleLiveGO3 then
if (self.camp==0 and heroConfig and heroConfig.Toward==1) or (self.camp==1 and heroConfig and heroConfig.Toward==2) then
@ -245,16 +247,15 @@ function MonsterView:OnSkillCastingStart(skill)
self.RoleLiveGO3.transform:DORotate(Vector3.New(0,0, 0),0.5)
end
self.castingNameNode:GetComponent("Image").sprite = self.spLoader:LoadSprite(self.combat.skillname)
animName="attack"
self:PlaySpineAnim(self.RoleLiveGOGraphic3, 0,animName , false)
coroutine.wait(1.5)
self:PlaySpineAnim(self.RoleLiveGOGraphic3, 0, "attack" , false)
-- coroutine.wait(1.5)
--self.turnEffect:SetActive(false)
end)
coroutine.wait(0.1)
self.turnEffect:SetActive(true)
end)
else
self:PlaySpineAnim(self.RoleLiveGOGraphic2, 0,animName , false)
self:PlaySpineAnim(self.RoleLiveGOGraphic2, 0, "attack" , false)
end