コード例 #1
0
    public void OnTriggerStay(Collider other)
    {
        F_Player oplayer = other.GetComponent <F_Player>();

        if (oplayer as FP_Ball_Paper != null && oplayer == F_Object.levelManager.Player)
        {
            oplayer.GetComponent <Rigidbody>().AddForce(force);
        }
    }
コード例 #2
0
    public void OnCollisionEnter(Collision collision)
    {
        if (StoneBrakHingeJoint == null)//已经破坏
        {
            return;
        }
        F_Player FP = collision.gameObject.GetComponent <F_Player>();

        if (F_Object.levelManager.Player != FP)
        {
            return;
        }
        if (FP.GetComponent <FP_Ball_Stone>() != null)
        {
            StoneBrakHingeJoint.breakForce = 10;
        }
        else
        {
            StoneBrakHingeJoint.breakForce = float.PositiveInfinity;
        }
    }
コード例 #3
0
    /* over 暂停相关*/
    /*虚拟键盘接口相关*/

    /*
     * 在JoystickResPath中注册你的虚拟键盘插件路径,数组下标即菜单对应的buttonID,确保能够在游戏开始时正常加载
     * 注意,虚拟键盘也应该是F_Object
     * 在收到Pause的消息时需要隐藏
     * 在收到Pause false消息时显示
     * 当虚拟键盘开启的时候,可以操纵JoyListener类来实现角色控制
     * 如果是虚拟键盘,JoyListener实例的检测功能将在LevelManager中被销毁,
     * JoyListener中
     * L 方向键,是个二维向量,其中x控制球相对世界坐标x方向上的力
     * 旋转视角请在Update中将LeftR,RightR单帧置为1,LevelManager将在--LateUpdate-->fixedUpdate中处理
     * 视角抬高,请将JoyListener中的OverView置为1
     * 你可以制作你自己的虚拟键盘,包括对球施加力度的大小都是可控制的,输入方式也不一定是屏幕输入
     * /* over 虚拟键盘相关*/

    // Use this for initialization
    void Start()
    {
        DeathBigin = false;
        //初始化CurrentLevel
        CurrentLevel = PlayerPrefs.GetInt("LoadLevelINT", 1) - 1;
        //若不是手柄,则禁用手柄监听器
        if (((deviceType = (PlayerPrefs.GetInt("DeviceType"))) != (int)DeviceType.Type.Joystick) && joyListener != null)
        {
            joyListener.Start();//初始化静态变量
            Destroy(joyListener);
        }
        scoreSaver = new ScoreSaver(Application.persistentDataPath + "/gamesave");
        if (CameraAim == null)
        {
            CameraAim = Player.GetComponent <Transform>();
        }
        CameraDirectionAnimator = CameraDirection.GetComponent <Animator>();
        theCameraT = theCamera.GetComponent <Transform>();

        //显示DeathAnim
        DeathAnimi.gameObject.SetActive(true);
        if (ShowGameUI)
        {
            GameUI.SetActive(true);
        }

        //加载移动端控制插件
        if (deviceType == (int)DeviceType.Type.TouchScreen)
        {
            int JoyType = PlayerPrefs.GetInt("TouchKeyboardId", 0);
            if (JoystickResPath.Length > JoyType)
            {
                Instantiate(Resources.Load(JoystickResPath[JoyType]));
            }
        }
    }