//---------------------------------------------------------------------------- void GroupBuf::OnAdded () { Buf::OnAdded(); mBeforeGroup = mCharacter->GetGroup(); Scene *scene = PX2_PROJ.GetScene(); Character *targetChar = DynamicCast<Character>(scene->GetActorByID(mToGroupCharacterID)); if (targetChar) { mCharacter->SetGroup(targetChar->GetGroup()); } else { SetOver(true); } }
//---------------------------------------------------------------------------- void GroupBuf::Update (double appSeconds, double elapsedSeconds) { Buf::Update(appSeconds, elapsedSeconds); Scene *scene = PX2_PROJ.GetScene(); Character *targetChar = DynamicCast<Character>(scene->GetActorByID(mToGroupCharacterID)); if (targetChar) { mCharacter->SetGroup(targetChar->GetGroup()); if (targetChar->IsDead() || targetChar->IsFreezed()) SetOver(true); } else { SetOver(true); } }
//---------------------------------------------------------------------------- void SkillStepLink::OnEnter (SkillInstance *instance) { SkillStep::OnEnter(instance); Skill *skill = instance->GetSkill(); Character *character = skill->GetCharacter(); Scene *scene = character->GetScene(); Node *sceneNode = DynamicCast<Node>(scene->GetSceneNode()); APoint charPos = character->GetPosition(); int aimTarget = instance->GetAimTarget(); Character *aimTargetChar = DynamicCast<Character>(scene->GetActorByID( aimTarget)); if (aimTargetChar) { SkillActorLinkPtr skillActorLink = new0 SkillActorLink(); instance->AddSkillActor(aimTarget, skillActorLink); skillActorLink->SetID(10000+scene->GetNextID()); skillActorLink->Initlize(); if (!mSelfEffectFilename.empty()) skillActorLink->SetMovableFilename(mSelfEffectFilename); skillActorLink->SetFromActorID(character->GetID()); skillActorLink->SetFromActorAnchor(mSelfEffectAnchor); if (IsLinkToActor()) { skillActorLink->SetTargetType(SkillActorLink::TT_ACTOR); skillActorLink->SetToActorID(aimTarget); } else { APoint toPos = charPos + mLinkDir * mSpeed * mLinkToTime; skillActorLink->SetTargetType(SkillActorLink::TT_POSITION); skillActorLink->SetToPosition(toPos); } skillActorLink->SetPosition(charPos); skillActorLink->SetLinkSpeed(GetSpeed()); skillActorLink->ShowHelpMovable(false); scene->AddActor(skillActorLink); skillActorLink->Start(); if (!mSelfPosEffectFilename.empty()) { APoint pos = character->GetPosition(); Transform trans; trans.SetTranslate(pos); trans.SetRotate(character->GetMovable()->WorldTransform.GetRotate()); if (!mSelfPosEffectFilename.empty()) { Node *anchor = character->GetAnchor(mSelfPosEffectAnchor); if (anchor) { //trans = anchor->WorldTransform; trans.SetTranslate(anchor->WorldTransform.GetTranslate()); } } Object *obj = PX2_RM.BlockLoadShareCopy(mSelfPosEffectFilename, false, false, true); if (obj) { EffectNode *effectNode = DynamicCast<EffectNode>(obj); if (effectNode) { effectNode->SetSelfCtrled(true); effectNode->WorldTransform = trans; effectNode->WorldTransformIsCurrent = true; sceneNode->AttachChild(effectNode); effectNode->ResetPlay(); PX2_DM.AddDeletingObj(effectNode, mSelfPosEffectTime, 3.0f); } } } } else { if (PX2_PROJ.IsInEditor()) { SkillActorLinkPtr skillActorLink = new0 SkillActorLink(); instance->AddSkillActor(aimTarget, skillActorLink); skillActorLink->SetID(10000+scene->GetNextID()); skillActorLink->Initlize(); if (!mSelfEffectFilename.empty()) skillActorLink->SetMovableFilename(mSelfEffectFilename); skillActorLink->SetFromActorID(character->GetID()); skillActorLink->SetFromActorAnchor(mSelfEffectAnchor); if (IsLinkToActor()) { skillActorLink->SetTargetType(SkillActorLink::TT_ACTOR); skillActorLink->SetToActorID(aimTarget); } else { APoint toPos = charPos + mLinkDir * mSpeed * mLinkToTime; skillActorLink->SetTargetType(SkillActorLink::TT_POSITION); skillActorLink->SetToPosition(toPos); } skillActorLink->SetPosition(charPos); skillActorLink->SetLinkSpeed(GetSpeed()); skillActorLink->ShowHelpMovable(false); scene->AddActor(skillActorLink); skillActorLink->Start(); } else { // over } } }