Пример #1
0
    public static CHumanState_Wait Instance()
    {
        if (instance == null)
        {
            instance = new CHumanState_Wait();
        }

        return(instance);
    }
Пример #2
0
    void SetState()
    {
        switch (m_synclocalHumanState)
        {
        case (int)StateID.BIKURI:
            m_human.PStateMachine.ChangeState(CHumanState_Bikuri.Instance());
            break;

        case (int)StateID.CARRY:
            m_human.PStateMachine.ChangeState(CHumanState_Carry_Motion.Instance());
            break;

        case (int)StateID.DASH:
            m_human.PStateMachine.ChangeState(CHumanState_Dash_Motion.Instance());
            break;

        case (int)StateID.DEAD:
            m_human.PStateMachine.ChangeState(CHumanState_Dead.Instance());
            break;

        case (int)StateID.GET:
            m_human.PStateMachine.ChangeState(CHumanState_Get.Instance());
            break;

        case (int)StateID.ITEM:
            m_human.PStateMachine.ChangeState(CHumanState_Item.Instance());
            break;

        case (int)StateID.MAIN:
            m_human.PStateMachine.ChangeState(CHumanState_Main.Instance());
            break;

        case (int)StateID.MOVE:
            m_human.PStateMachine.ChangeState(CHumanState_Move_Motion.Instance());
            break;

        case (int)StateID.SET:
            m_human.PStateMachine.ChangeState(CHumanState_Set.Instance());
            break;

        case (int)StateID.USE:
            m_human.PStateMachine.ChangeState(CHumanState_Use.Instance());
            break;
        }

        switch (m_syncGlobalHumanState)
        {
        case (int)StateID.PANIK:
            m_human.PStateMachine.SetGlobalStateState(CHumanState_Perception.Instance());
            break;

        case (int)StateID.WAIT:
            m_human.PStateMachine.SetGlobalStateState(CHumanState_Wait.Instance());
            break;
        }
    }
Пример #3
0
    /// <summary>
    /// Main
    /// </summary>
    ///

    void Start()
    {
        IsLocal = false;
        if (m_dummyGhost == null)
        {
            m_dummyGhost = GameObject.FindGameObjectsWithTag("DummyGhost");//優先
        }
        if (m_ghost == null)
        {
            m_ghost = GameObject.Find("Ghost(Clone)");//優先
            if (m_ghost == null)
            {
                m_ghost = GameObject.Find("Ghost");
            }
        }
        if (m_find == null)
        {
            foreach (Transform child in this.transform)
            {
                if (child.name == "find")
                {
                    m_find = child.gameObject;
                }
            }
        }
        if (m_candy == null)
        {
            foreach (Transform child in this.transform)
            {
                if (child.name == "Candy")
                {
                    m_candy = child.gameObject;
                }
            }
        }
        if (m_animator == null)
        {
            m_animator = this.GetComponent <Animator>();
        }

        if (ExMark == null || Impatiencle == null || Chikin == null)
        {
            foreach (Transform child in this.transform)
            {
                if (child.name == "ExclamationMark")
                {
                    ExMark = child.GetComponent <ParticleSystem>();
                }
                if (child.name == "ImpatienceParticle")
                {
                    Impatiencle = child.GetComponent <ParticleSystem>();
                }
                if (child.name == "StanChickParticle")
                {
                    Chikin = child.GetComponent <ParticleSystem>();
                    Chikin.gameObject.SetActive(false);
                }
            }
        }

        beatSE           = new CBeat();
        m_shumanScore    = new SHumanScore();
        m_hp             = 1;
        m_reLife         = MaxLifeTime;
        m_hunmanstrength = 100;
        m_hunmanTime     = 1;
        m_pStateMachine  = new CStateMachine <CHuman>(this);              //初始化状态机
        m_pStateMachine.SetCurrentState(CHumanState_Main.Instance());     //设置一个当前状态
        m_pStateMachine.SetGlobalStateState(CHumanState_Wait.Instance()); //设置全局状态
        m_candyFlag = true;
        ShumanScore.resuscitation  = 0;
        ShumanScore.setAlterCandle = 0;
        ShumanScore.setCandle      = 0;
        m_isReLifeScoreOn          = false;
    }
Пример #4
0
    public override void Execute(CHuman human)
    {
        if (human.Dead == false)
        {
            human.AnimatorEDT.SetInteger("GState", 1);

            if (human.LightOn == true)
            {
                human.PlusStrength(human.Strength);
            }

            if (human.Ghost != null)
            {
                float lenth = (human.transform.position - human.Ghost.transform.position).magnitude;
                range = lenth;
                if (lenth > human.Area)
                {
                    if (DghostPniku == 0)
                    {
                        human.PStateMachine.SetGlobalStateState(CHumanState_Wait.Instance());
                        human.AnimatorEDT.SetInteger("GState", 0);
                    }
                    GhostPniku = 0;
                }
                else
                {
                    GhostPniku = 1;
                }
            }
            if (human.DummyGhost != null)
            {
                foreach (GameObject obj in human.DummyGhost)
                {
                    if (obj != null)
                    {
                        if (obj.GetComponent <DummyGhost>() != null)
                        {
                            if (obj.GetComponent <DummyGhost>().IsAct == true)
                            {
                                float lenth = (human.transform.position - obj.transform.position).magnitude;
                                if (lenth < range)
                                {
                                    range = lenth;
                                }
                                if (lenth < 1)
                                {
                                    lenth = 1f;
                                }
                                if (lenth > human.Area)
                                {
                                    DghostPniku = 0;
                                }
                                else
                                {
                                    DghostPniku = 1;
                                    break;
                                }
                            }
                            else
                            {
                                DghostPniku = 0;
                            }
                        }
                    }
                }
                if (DghostPniku == 0)
                {
                    if (GhostPniku == 0)
                    {
                        human.PStateMachine.ChangeGlobalState(CHumanState_Wait.Instance());
                        human.AnimatorEDT.SetInteger("GState", 0);
                    }
                }
            }
        }
        if (human.IsLocal || human.IsDebug)
        {
            human.beatSE.Panic(1 - range / human.Area);
        }
    }