Exemplo n.º 1
0
    /// <summary>
    /// 设置当前角色
    /// </summary>
    /// <param name="data">Data.</param>
    public void setChar(string data = "RHINOCEROS")
    {
        if (GBM.GameWin || GBM.GameLost || GBM.GamePause)
        {
            return;
        }
        Instantiate(AssetConfig.CharChangeEffect, transform.position, Quaternion.identity);
        switch (data)
        {
        case "CRANE":
            XNMode.SetActive(true);
            DDHMode.SetActive(true);
            SetAnimState("notWalking");
            SetAnimState("onUnlocking");
            anim = DDHMode.GetComponent <Animator>();
            GetComponent <CapsuleCollider>().enabled = false;
            XNPosition   = transform.position;
            XNPosition.y = transform.position.y + 2.5f;
            XNMode.transform.position = XNPosition;
            OnCameraChange(-1, 5, 3);
            HUD.setPCMessage("丹顶鹤", GameDataConfig.ColorWite);
            GSM.BabiesVisible(false);
            break;

        case "MONKEY":
            XNMode.SetActive(false);
            JSHMode.SetActive(true);
            anim   = JSHMode.GetComponent <Animator>();
            Record = transform.position;
            HUD.setPCMessage("金丝猴", GameDataConfig.ColorWite);
            break;

        case "PANGOLIN":
            XNMode.SetActive(false);
            CSJMode.SetActive(true);
            anim   = CSJMode.GetComponent <Animator>();
            Record = transform.position;
            HUD.setPCMessage("穿山甲", GameDataConfig.ColorWite);
            OnCameraChange(1, -3, -3);
            GSM.BabiesVisible(false);
            break;

        default:
            XNMode.SetActive(true);
            DDHMode.SetActive(false);
            JSHMode.SetActive(false);
            CSJMode.SetActive(false);
            GSM.BabiesVisible(true);
            CameraPosition          = transform.position;
            CamFollowPiont.position = CamFollowObj.position;
            GetComponent <NavMeshAgent>().enabled = false;
            transform.position = Record;
            GSM.MoveBabies(Record);
            XNPosition = transform.position;
            XNMode.transform.position = XNPosition;
            GetComponent <CapsuleCollider>().enabled = true;
            GetComponent <NavMeshAgent>().enabled    = true;
            GetComponent <NavMeshAgent>().SetDestination(Record);
            anim = XNMode.GetComponent <Animator>();
            SetAnimState("NoHanging");
            GSM.PlayerNextPoint = Record;
            break;
        }
    }