Exemplo n.º 1
0
    override public void Destroy()
    {
        //清除挂接的特效的关联,特效就不会随着物体的删除而删除
        foreach (ParticleAttachMent attach in mAttachParticles)
        {
            if (attach != null)
            {
                attach.parent = null;
                ParticleItem item = SceneManager.Instance.GetCurScene().GetParticleManager().GetParticle(attach.particleid);
                if (item != null && item.visual != null && item.visual.Visual != null)
                {
                    item.visual.VisualTransform.parent = null;

                    ParticleVisual.DestroyParticle(item.visual);
                }
            }
        }

        DestroyVisual();

        mStateController = null;

        mVisualTasks = null;
//         if(mVisual != null)
//         {
//             mVisual.Destroy();
//             mVisual = null;
//         }
        base.Destroy();
    }
Exemplo n.º 2
0
    /// <summary>
    /// 死亡的前端表现.
    /// </summary>
    private void createDeathClientBehaviour(ImpactDamageType damageType, AttackerAttr killerAttr)
    {
        // 材质死亡(特效).
        ErrorHandler.Parse(
            mOwner.AddMaterialBehaviour(MaterialBehaviourDef.OnMaterialDie, damageType, killerAttr.EffectStartDirection),
            "failed to add death material effect"
            );

        // 死亡动作.
        MecanimStateController stateControl = mOwner.GetStateController();
        AnimatorProperty       animSet      = stateControl.AnimSet;

        if (animSet != null && !string.IsNullOrEmpty(mOwner.GetDeathAnimation()))        //animSet.NumOfDie > 0)
        {
            AnimActionDeath death = AnimActionFactory.Create(AnimActionFactory.E_Type.Death) as AnimActionDeath;
            death.dieAnim = mOwner.GetDeathAnimation();
            if (stateControl.AnimSet != null)
            {
                mDieAnimationHashCode = stateControl.AnimSet.GetStateHash(death.dieAnim);
            }
            stateControl.DoAction(death);
        }


        //mOwner.SetDeathMaterial("dssipate");
        //mOwner.SetDeathMaterial("burn_out");
        // 死亡声音.
        if (mOwner.GetDeadSound() != -1)
        {
            SoundManager.Instance.Play(mOwner.GetDeadSound());
        }
    }
Exemplo n.º 3
0
    protected override void onStopped(bool finished)
    {
        // 停止移动动画
        MecanimStateController statecontrol = mOwner.GetStateController();
        bool lowerMove = mOwner.GetMovingType() == MovingType.MoveType_Lowwer;

        //AnimActionMove action = AnimActionFactory.Create(AnimActionFactory.E_Type.Move) as AnimActionMove;
        //action.type = AnimActionMove.MoveType.Stop;
        //mOwner.GetStateController().DoAction(action, lowerMove ? MecanimStateController.Statelayer.Move : MecanimStateController.Statelayer.Normal);

        if (mSoundInsId != -1)
        {
            SoundManager.Instance.RemoveSoundByID(mSoundInsId);
        }
    }
Exemplo n.º 4
0
    protected override void onStarted()
    {
        // 播放移动动画

        if (mOwner == null || mOwner.GetStateController() == null)
        {
            return;
        }
        // 停止移动动画
        MecanimStateController statecontrol = mOwner.GetStateController();
        bool lowerMove = mOwner.GetMovingType() == MovingType.MoveType_Lowwer;

        mOwner.GetStateController().DoAction(AnimActionFactory.E_Type.Move, lowerMove ? MecanimStateController.Statelayer.Move : MecanimStateController.Statelayer.Normal);

        if (mOwner.GetWalkSound() != -1)
        {
            mSoundInsId = SoundManager.Instance.Play(mOwner.GetWalkSound(), null, true);
        }
    }
Exemplo n.º 5
0
    virtual protected void onModelLoaded(GameObject obj)
    {
        obj.layer = GetObjectLayer();


        if (mVisual != null && mVisual.Visual != null)
        {
            mVisual.Visual.tag = GetObjectTag();
        }

        if (DataManager.ModelTable.ContainsKey(mModelResID))
        {
            ModelTableItem modelTab = DataManager.ModelTable[mModelResID] as ModelTableItem;

            obj.transform.localScale = Vector3.one * modelTab.scale;
        }

        mStateController = new MecanimStateController();
        mStateController.Setup(mVisual.AnimManager, this);
    }