当前位置: 首页>>代码示例>>C#>>正文


C# UnityEngine.MonoBehaviour类代码示例

本文整理汇总了C#中UnityEngine.MonoBehaviour的典型用法代码示例。如果您正苦于以下问题:C# MonoBehaviour类的具体用法?C# MonoBehaviour怎么用?C# MonoBehaviour使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MonoBehaviour类属于UnityEngine命名空间,在下文中一共展示了MonoBehaviour类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Play

		public void Play(MonoBehaviour owner, float delay, float time, 
			System.Action<float> whenUpdate, 
			System.Action<bool> whenFinish)
		{
			this.Play(owner, delay, time, false, iTweenSimple.LoopType.none, 
				whenUpdate, null, whenFinish);
		}
开发者ID:kybird,项目名称:PhoenixProject,代码行数:7,代码来源:iTweenSimplePlayer.cs

示例2: AutoNotificationManager

 public AutoNotificationManager(MonoBehaviour behaviour)
 {
     if (behaviour == null) throw new System.ArgumentNullException("behaviour");
     _behaviour = behaviour;
     _handlers = new Dictionary<System.Type, System.Delegate>();
     this.Init();
 }
开发者ID:Gege00,项目名称:spacepuppy-unity-framework,代码行数:7,代码来源:AutoNotificationManager.cs

示例3: HasSameTagAs

        public static bool HasSameTagAs(this Collider source, MonoBehaviour self)
        {
            if (source == null || source.gameObject == null || source.gameObject.tag == null)
                return false;

            return source.gameObject.tag.Equals(self.gameObject.tag, StringComparison.OrdinalIgnoreCase);
        }
开发者ID:mtsouris81,项目名称:building-heist,代码行数:7,代码来源:_extensions.cs

示例4: Initialize

 public void Initialize(MonoBehaviour parent)
 {
     foreach(Bullet.Action action in actions)
     {
         action.Initialize(parent);
     }
 }
开发者ID:james7132,项目名称:Hysteria,代码行数:7,代码来源:Tags.cs

示例5: IsSupported

        public static bool IsSupported(Shader s, bool needDepth, bool needHdr, MonoBehaviour effect)
        {
            if (s == null || !s.isSupported)
            {
                Debug.LogWarningFormat("Missing shader for image effect {0}", effect);
                return false;
            }

            if (!SystemInfo.supportsImageEffects || !SystemInfo.supportsRenderTextures)
            {
                Debug.LogWarningFormat("Image effects aren't supported on this device ({0})", effect);
                return false;
            }

            if (needDepth && !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
            {
                Debug.LogWarningFormat("Depth textures aren't supported on this device ({0})", effect);
                return false;
            }

            if (needHdr && !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf))
            {
                Debug.LogWarningFormat("Floating point textures aren't supported on this device ({0})", effect);
                return false;
            }

            return true;
        }
开发者ID:XuTenTen,项目名称:MultiThreadComponent,代码行数:28,代码来源:ImageEffectHelper.cs

示例6: Open

        /// <summary>
        /// Create modal helper with the specified parent, sprite and color.
        /// </summary>
        /// <param name="parent">Parent.</param>
        /// <param name="sprite">Sprite.</param>
        /// <param name="color">Color.</param>
        /// <returns>Modal helper index</returns>
        public static int Open(MonoBehaviour parent, Sprite sprite = null, Color? color = null)
        {
            //проверить есть ли в кеше
            if (!Templates.Exists(key))
            {
                Templates.FindTemplates();
                CreateTemplate();
            }

            var modal = Templates.Instance(key);

            modal.transform.SetParent(Utilites.FindCanvas(parent.transform), false);
            modal.gameObject.SetActive(true);
            modal.transform.SetAsLastSibling();

            var rect = modal.GetComponent<RectTransform>();
            rect.sizeDelta = new Vector2(0, 0);
            rect.anchorMin = new Vector2(0, 0);
            rect.anchorMax = new Vector2(1, 1);
            rect.anchoredPosition = new Vector2(0, 0);

            var img = modal.GetComponent<Image>();
            if (sprite!=null)
            {
                img.sprite = sprite;
            }
            if (color!=null)
            {
                img.color = (Color)color;
            }

            used.Add(modal.GetInstanceID(), modal);
            return modal.GetInstanceID();
        }
开发者ID:AresLee,项目名称:FarmerSimulator,代码行数:41,代码来源:ModalHelper.cs

示例7: DrawAudioFilterGUI

 public void DrawAudioFilterGUI(MonoBehaviour behaviour)
 {
   int filterChannelCount = AudioUtil.GetCustomFilterChannelCount(behaviour);
   if (filterChannelCount <= 0)
     return;
   if (this.dataOut == null)
     this.dataOut = new EditorGUI.VUMeter.SmoothingData[filterChannelCount];
   double num = (double) AudioUtil.GetCustomFilterProcessTime(behaviour) / 1000000.0;
   float r = (float) num / ((float) AudioSettings.outputSampleRate / 1024f / (float) filterChannelCount);
   GUILayout.BeginHorizontal();
   GUILayout.Space(13f);
   GUILayout.BeginVertical();
   EditorGUILayout.Space();
   for (int channel = 0; channel < filterChannelCount; ++channel)
     EditorGUILayout.VUMeterHorizontal(AudioUtil.GetCustomFilterMaxOut(behaviour, channel), ref this.dataOut[channel], GUILayout.MinWidth(50f), GUILayout.Height(5f));
   GUILayout.EndVertical();
   Color color = GUI.color;
   GUI.color = new Color(r, 1f - r, 0.0f, 1f);
   GUILayout.Box(string.Format("{0:00.00}ms", (object) num), new GUILayoutOption[2]
   {
     GUILayout.MinWidth(40f),
     GUILayout.Height(20f)
   });
   GUI.color = color;
   GUILayout.EndHorizontal();
   EditorGUILayout.Space();
   GUIView.current.Repaint();
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:28,代码来源:AudioFilterGUI.cs

示例8: MarkCapturePhase

        public static IDisposable MarkCapturePhase(MonoBehaviour target)
        {
            Count++;
            return Observable.TimerFrame(AnimationSpeed * Count)
                .Subscribe(_ => target.GetComponent<Renderer>().material.color = Color.green);

        }
开发者ID:ClusterVR,项目名称:teleportation_for_vive,代码行数:7,代码来源:Sample14_PresenterBase.cs

示例9: HollywoodMVCSContext

 public HollywoodMVCSContext(MonoBehaviour view) : base(view, ContextStartupFlags.MANUAL_MAPPING)
 {
     _hollywoodContextView = view.GetComponent<IHollywoodContextView>();
     if (_hollywoodContextView == null)
         throw (new Exception("HollywoodMVCSContext constructor error, there's no IHollywoodContextView instance on context's view !!!"));
     Start();
 }
开发者ID:flow38,项目名称:StrangeIoC-Hollywood-extension,代码行数:7,代码来源:HollywoodMVCSContext.cs

示例10: AddToActionList

 private void AddToActionList(List<SetEnabledOnDialogueEvent.SetEnabledAction> actions, MonoBehaviour component, Toggle state)
 {
     SetEnabledOnDialogueEvent.SetEnabledAction newAction = new SetEnabledOnDialogueEvent.SetEnabledAction();
     newAction.state = state;
     newAction.target = component;
     actions.Add(newAction);
 }
开发者ID:88dre88,项目名称:ProyectoU,代码行数:7,代码来源:PlayerSetupWizard.cs

示例11: StepControl

        public StepControl(MasterPlayer player, MonoBehaviour context)
        {
            m_player	= player;
            m_context	= context;

            m_context.StartCoroutine(UpdateCo());
        }
开发者ID:rebuilder17,项目名称:fsnengine,代码行数:7,代码来源:StepControl.cs

示例12: FlipXScale

		/// <summary>
		/// just sets the x scale to -x
		/// </summary>
		/// <param name="component"></param>
		public static void FlipXScale(MonoBehaviour component)
		{
			RectTransform rectTransform = component.GetComponent<RectTransform>();
			Vector3 scale = rectTransform.localScale;
			scale.x *= -1f;
			rectTransform.localScale = scale;
		}
开发者ID:paveltimofeev,项目名称:GameJamFramework,代码行数:11,代码来源:UIUtilities.cs

示例13: Request

        internal static IEnumerator Request(MonoBehaviour caller, EngageRequest request, EngageResponse response)
        {
            string requestJSON = request.ToJSON();
            string url = DDNA.Instance.ResolveEngageURL(requestJSON);

            HttpRequest httpRequest = new HttpRequest(url);
            httpRequest.HTTPMethod = HttpRequest.HTTPMethodType.POST;
            httpRequest.HTTPBody = requestJSON;
            httpRequest.TimeoutSeconds = DDNA.Instance.Settings.HttpRequestEngageTimeoutSeconds;
            httpRequest.setHeader("Content-Type", "application/json");

            System.Action<int, string, string> httpHandler = (statusCode, data, error) => {

                string engagementKey = "DDSDK_ENGAGEMENT_" + request.DecisionPoint + "_" + request.Flavour;
                if (error == null && statusCode >= 200 && statusCode < 300) {
                    try {
                        PlayerPrefs.SetString(engagementKey, data);
                    } catch (Exception exception) {
                        Logger.LogWarning("Unable to cache engagement: "+exception.Message);
                    }
                } else {
                    Logger.LogDebug("Engagement failed with "+statusCode+" "+error);
                    if (PlayerPrefs.HasKey(engagementKey)) {
                        Logger.LogDebug("Using cached response");
                        data = "{\"isCachedResponse\":true," + PlayerPrefs.GetString(engagementKey).Substring(1);
                    } else {
                        data = "{}";
                    }
                }

                response(data, statusCode, error);
            };

            yield return caller.StartCoroutine(Network.SendRequest(httpRequest, httpHandler));
        }
开发者ID:deltaDNA,项目名称:unity-sdk,代码行数:35,代码来源:Engage.cs

示例14: RevertInfo

 /// <summary>
 /// Set up a revert info for a static object.
 /// </summary>
 /// <param name="monoBehaviour">The MonoBehaviour that is making this RevertInfo.</param>
 /// <param name="type">The type of the static object</param>
 /// <param name="memberName">The member name of the field/property/method to be called on revert.</param>
 /// <param name="value">The current value you want to save.</param>
 public RevertInfo(MonoBehaviour monoBehaviour, Type type, string memberName, object value)
 {
     this.MonoBehaviour = monoBehaviour;
     this.Type = type;
     this.value = value;
     this.MemberInfo = Type.GetMember(memberName);
 }
开发者ID:ArthurRasmusson,项目名称:UofTHacks2016,代码行数:14,代码来源:RevertInfo.cs

示例15: ProcessBehaviour

        private void ProcessBehaviour(MonoBehaviour behaviour)
        {
            Type componentType = behaviour.GetType();
            ClassDataHolder data = ReflectionDataCache.GetClassData(componentType);

            for (int i = 0; i < data.PropertyInfos.Length; i++)
            {
                PropertyInfo property = data.PropertyInfos[i];
                if (data.PropertyAttributes[i]) continue;
                ThrowIfNotNull(property.GetValue(behaviour, null));

                object dependency = _context.Resolve(property.PropertyType);
                property.SetValue(behaviour, dependency, null);
            }

            for (int i = 0; i < data.FieldInfos.Length; i++)
            {
                FieldInfo field = data.FieldInfos[i];
                if (data.FieldAttributes[i]) continue;
                ThrowIfNotNull(field.GetValue(behaviour));

                object dependency = _context.Resolve(field.FieldType);
                field.SetValue(behaviour, dependency);
            }
        }
开发者ID:ChicK00o,项目名称:behaviour_inject,代码行数:25,代码来源:InjectorBehaviour.cs


注:本文中的UnityEngine.MonoBehaviour类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。