Exemplo n.º 1
0
    protected override void Init()
    {
        base.Init();
        animFSM      = base.animFSM as MobAnimFSM;
        rendererCtrl = this.gameObject.GetComponentInChildrenFast <MobRendererCtrl>();
        rendererCtrl.SetLayer(LayerMask.NameToLayer("Preview"));
        rendererCtrl.Init(actorInfo, fxCtrl);

        inited_ = true;

        if (animFSM != null)
        {
            animFSM.StartStateMachine();
            if (moveFSM != null)
            {
                if (moveFSM.isMoving)
                {
                    animFSM.Move();
                }
                else
                {
                    animFSM.Idle();
                }
            }
            animFSM.IdleImmediate();
            if (idleAnimName != string.Empty)
            {
                InitAnimation();
            }
        }
        else
        {
            GameSys.LogError("怪物" + gameObject.name + "没有动画组件!");
        }

        if (rendererCtrl)
        {
            rendererCtrl.Show(true);
        }
    }
Exemplo n.º 2
0
    protected override void Init()
    {
        base.Init();
        animFSM      = base.animFSM as MobAnimFSM;
        rendererCtrl = this.gameObject.GetComponentInChildrenFast <MobRendererCtrl>();
        rendererCtrl.ResetOriginalLayer(LayerMask.NameToLayer("Monster"));
        rendererCtrl.SetLayer(this.gameObject.layer);
        if (actorInfo.CurShowDictionary.Count > 0)
        {
            rendererCtrl.Init(actorInfo, fxCtrl);
        }
        rendererCtrl.OnCombineSuceess += OnCombineSucess;
        height          = actorInfo.Hight;
        nameHeight      = actorInfo.NameHight;
        MainPlayerFocus = true;
        beAttackRadius  = actorInfo.ColliderRadius;
        if (headTextCtrl == null)
        {
            headTextCtrl = this.gameObject.GetComponent <HeadTextCtrl>();
        }
        if (headTextCtrl == null)
        {
            headTextCtrl = this.gameObject.AddComponent <HeadTextCtrl>();
        }
        if (!actorInfo.IsActor) //过场动画演员不展示名字
        {
            UpdateName();
        }

        inited_ = true;

        if (animFSM != null)
        {
            InitAnimation();
            if (moveFSM != null)
            {
                if (moveFSM.isMoving)
                {
                    animFSM.Move();
                }
                else
                {
                    animFSM.Idle();
                }
            }
        }
        else
        {
            Debug.LogError("怪物" + gameObject.name + "没有动画组件!");
        }

        if (rendererCtrl)
        {
            rendererCtrl.Show(false, true);
        }
        ActiveBoxCollider(true, actorInfo.ColliderRadius);
        if (fxCtrl != null)
        {
            if (actorInfo.IsBoss)
            {
                fxCtrl.DoBossEffect(actorInfo.RingSize, "m_f_006");
            }
            if (actorInfo.IsElite)
            {
                fxCtrl.DoBossEffect(actorInfo.RingSize, "zb_qh_dj_005");
            }
            if (actorInfo.IsSedan)
            {
                fxCtrl.DoSedanEffect();
            }
        }
        stateMachine.Start();
    }