zoukankan      html  css  js  c++  java
  • 【狼】狼的unity3d脚本学习

     

    记录学习中的问题,时刻更新

    unity获取鼠标所在位置
    BOOL GetCursorPos( 
      LPPOINT lpPoint
    ); 
    获取鼠标所在位置,不过原点在左下角
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    yield return new WaitForSeconds(5);// wait for 5 seconds等待5秒

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////获取脚本中的函数或变量
    GameObject.Find("要查找的gameobject的名字").GetComponent<脚本名字>().变量或者函数

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    Player Settings/Resolution and Presentation/ Default Orientation 中选 Landscape 开头        设置安卓横竖屏
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // Plays an animation only if we are not playing it already.function OnMouseEnter() { if (!animation.isPlaying) animation.Play();}第二种:// Plays an animation only if we are not playing it already.function OnMouseEnter() { if (!animation.IsPlaying("mouseOverEffect")) animation.Play("mouseOverEffect");}判断动画是否结束
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    把animationstate中的WrapMode设置为WrapMode.Loop   设置动画循环

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    否动态改变Label的内容
    public UILabel Label;
    Label.text = " ";  
    双引号中是要改变的内容
    当然在场景中要把对应的Label 拖到这个脚本上

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     
    Time.timeScale = 0;   设置暂停           恢复就
    Time.timeScale = 1;

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    最好不要用Onmousevoer 等这些自带检测。 如果有两事件都悲鼠标检测到就会处罚两个事件。
    用射线检测更好。对于换装和装备的定义可以用类?
    class Equ 定义 名字 属性(如效果、和 装备属于那个地方的) 定义图标
    然后如果是单机的话推荐用个xml 来配置这些文件。
    这样就剩下读写xml。
    你可以下个NGUI插件 里面有个sence 有个 换装备的。估计里面的效果都是你想要的
    任何东西都是靠不断的恒心。学习也是如此。Unity 支持 JS C# 作为脚本语言。虽然里面做了限制但是基本上里面的东西能用。Using System.XML;Using System.IO...
    你可以百度“ C# 读取XML ”
    NGUI 是个插件 下载下来。。。专研下 因为 我也是才学习Unity 所以没有研究过。看过例子 有换装 所以推荐

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    #region和#endregion配合使用,用于把代码折叠起来(c#)
  • 相关阅读:
    Spring Cloud Consul Config 知识点
    RabbitMQ 的 docker 镜像使用
    Spring Cloud Config 知识点
    漫画:什么是服务熔断?
    Flux 和 Mono 的区别
    同时引入依赖:spring-cloud-starter-gateway 和 spring-boot-starter-web,报错
    Feign 报错:The bean 'service-producer.FeignClientSpecification', defined in null, could not be registered. A bean with that name has already been defined in null and overriding is disabled.
    Feign和OpenFeign的区别
    Maven 报错:Compilation of Maven projects is supported only if external build is started from an IDE.
    使用 application.properties 中配置的属性,举例:@Value("${server.port}")
  • 原文地址:https://www.cnblogs.com/zhanlang96/p/3726734.html
Copyright © 2011-2022 走看看