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


C# MonoBehaviour类代码示例

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


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

示例1: Start

 public override void Start(MonoBehaviour behaviour, Sequencer.StateInstance aState)
 {
     Entity ai = (Entity)behaviour;
     EntityMovement em = ai.entMove;
     em.Jump(speedMin < speedMax ? Random.Range(speedMin, speedMax) : speedMin);
     ai.state = state;
 }
开发者ID:ddionisio,项目名称:ludum-dare-25,代码行数:7,代码来源:AIJump.cs

示例2: run_list

	public static IEnumerator run_list(MonoBehaviour runner, IEnumerable<ActionWrapper> actions){
		foreach (ActionWrapper aw in actions) {
			Debug.Log("Running Coroutine");
			yield return runner.StartCoroutine(aw.run());
		}
		yield return null;
	}
开发者ID:mrunderhill89,项目名称:guardian_of_the_fields_the_strawberry_jam,代码行数:7,代码来源:CoroutineUtils.cs

示例3: ProcessMessage

    void ProcessMessage(MonoBehaviour behaviour)
    {
        bool AllOn  = true;
        bool AllOff = true;

        if (!Eneble){
            return;
        }
        for(int i = 0; i < TriggerButtonsOn.Length; i++){
            if(TriggerButtonsOn[i].State == c2StateButton.eButtonState.Off){
                AllOn = false;
            }
        }

        for(int i = 0; i < TriggerButtonsOff.Length; i++){
            if(TriggerButtonsOff[i].State == c2StateButton.eButtonState.On){
                AllOff = false;
            }
        }

        if(AllOn && AllOff){
            State = true;
            animation.CrossFade("Open");
        }
    }
开发者ID:qtLex,项目名称:Good_Evil_Level_1,代码行数:25,代码来源:CCombinationLock.cs

示例4: PerformInjections

 public void PerformInjections(MonoBehaviour component)
 {
     foreach (IInjector injector in _injectors)
     {
         injector.PerformAllInjections(component);
     }
 }
开发者ID:edgarjcfn,项目名称:MakeyMakeyMaze,代码行数:7,代码来源:InjectorSingleton.cs

示例5: displayInformationForUnit

	private void displayInformationForUnit(IGameEntity entity) {

		//Remove previous values
		hideExtendedInformationPanel();
		    
		//Display window info
		windowInfo.GetComponent<Image>().enabled = true;

		currentPanel = Panel.UNIT;
		currentObject = (MonoBehaviour)entity;
		
		List<String> titles = new List<String>();
		titles.Add("Attack rate");
		titles.Add("Attack range");
		titles.Add("Movement rate");
		titles.Add("Resistance");
		titles.Add("Sight range");
		titles.Add("Strenght");
		titles.Add("Weapon Ability");
		List<String> values = new List<String>();
		values.Add(entity.info.unitAttributes.attackRate.ToString());
		values.Add(entity.info.unitAttributes.attackRange.ToString());
		values.Add(entity.info.unitAttributes.movementRate.ToString());
		values.Add(entity.info.unitAttributes.resistance.ToString());
		values.Add(entity.info.unitAttributes.sightRange.ToString());
		values.Add(entity.info.unitAttributes.strength.ToString());
		values.Add(entity.info.unitAttributes.weaponAbility.ToString());
		displayInformation(titles, values);
	}
开发者ID:srferran,项目名称:ES2015A,代码行数:29,代码来源:InformationController.Extended.cs

示例6: Start

    public override void Start(MonoBehaviour behaviour, Sequencer.StateInstance state)
    {
        Main.instance.cameraController.mode = mode;

        if(attachToPath.Length > 0) {
            GameObject go = ((SceneController)behaviour).SearchObject(attachToPath);
            if(go != null) {
                Main.instance.cameraController.attach = go.transform;
            }
            else {
                Debug.LogWarning("Path not found: "+attachToPath);
            }
        }
        else if(attachToWaypoint.Length > 0) {
            Transform t = WaypointManager.instance.GetWaypoint(attachToWaypoint);
            if(t != null) {
                Main.instance.cameraController.attach = t;
            }
            else {
                Debug.LogWarning("Can't find waypoint: "+attachToWaypoint);
            }
        }

        if(immediate) {
            Main.instance.cameraController.CancelMove();
        }
    }
开发者ID:ddionisio,项目名称:game-off-2012,代码行数:27,代码来源:SceneActionCamera.cs

示例7: Start

    public override void Start(MonoBehaviour behaviour, Sequencer.StateInstance state)
    {
        Entity ai = (Entity)behaviour;
        PlanetAttach pa = ai.planetAttach;
        AIState aiState = (AIState)state;

        float speed = speedMin < speedMax ? Random.Range(speedMin, speedMax) : speedMin;
        if(speed > 0) {
            if(followPlayer) {
                Player player = SceneLevel.instance.player;

                aiState.curPlanetDir = pa.GetDirTo(player.planetAttach, followPlayerHorizontal);
            }
            else if(!useDir) {
                aiState.curPlanetDir = Util.Vector2DRot(new Vector2(1, 0), angle*Mathf.Deg2Rad);
            }

            pa.velocity = aiState.curPlanetDir*speed;

            ai.action = Entity.Action.move;
        }
        else {
            pa.velocity = Vector2.zero;

            ai.action = Entity.Action.idle;
        }

        if(resetAccel) {
            pa.accel = Vector2.zero;
        }
    }
开发者ID:ddionisio,项目名称:GitGirl,代码行数:31,代码来源:AISetVelocity.cs

示例8: DispatchMessage

    public void DispatchMessage(float delay, 	/*fa song zhe */int sender, 	/*jie shou zhe */int receiver, int msg,MonoBehaviour _be)
    {
        //jie shou zhe de zhi zhen
        BaseGameEntity pReceiver = EntityManager.Instance ().GetEntityFromID (receiver);

        //chuang jian yi ge xiao xi
        Telegram telegram = new Telegram (0, sender, receiver, msg,_be);

        if (delay <= 0.0f) {

            //li ji fa song xiao xi
            Discharge (pReceiver, telegram);
        } else {

            //yan chi fa song xiao xi
            float CurrentTime = Time.realtimeSinceStartup;

            telegram.DispatchTime = CurrentTime + delay;

            foreach(Telegram val in PriorityQ)
            {
                if(val.Sender == sender && val.Receiver == receiver && val.Msg ==msg)
                {
                    return ;
                }
            }

            PriorityQ.Add (telegram);

        }
    }
开发者ID:GhostSoar,项目名称:UnityGunShoot3D,代码行数:31,代码来源:MessageDispatcher.cs

示例9: Start

 public static YieldInstruction Start(CanvasGroup group, MonoBehaviour script, float from, float to, float time)
 {
     Stop(group, script);
     var coroutine = script.StartCoroutine(AnimateGroup(group, from, to, time));
     _fades.Add(group, coroutine);
     return coroutine;
 }
开发者ID:hybrid1969,项目名称:UnityTwine,代码行数:7,代码来源:ImageFade.cs

示例10: SubscribeToEvent

    public static void SubscribeToEvent(EGameEvent _e, MonoBehaviour _subscriber)
    {
        Initialize();

        // assert _gameEvent >= GameEvent.EVT_GOAL_SCORED && _gameEvent < GameEvent.COUNT
        evtSubscribers [(int)_e].Add (_subscriber);
    }
开发者ID:4ONSports,项目名称:Prototype_2,代码行数:7,代码来源:GameEventsHandler.cs

示例11: changeMotionModel

 public MonoBehaviour changeMotionModel(GlobalControl.motionModels newMotionModel)
 {
     //First, remove previous motion model
     DestroyImmediate (motionComponent);
     //Add the new motion model
     switch (newMotionModel){
         case GlobalControl.motionModels.DISCRETE:
             motionComponent = (MonoBehaviour)gameObject.AddComponent<MoveDiscrete>();
             break;
         case GlobalControl.motionModels.KINEMATIC:
             motionComponent = (MonoBehaviour)gameObject.AddComponent<MoveKinematic>();
             break;
         case GlobalControl.motionModels.DYNAMIC:
             motionComponent = (MonoBehaviour)gameObject.AddComponent<MoveDynamic>();
             break;
         case GlobalControl.motionModels.DIFFERENTIAL:
             motionComponent = (MonoBehaviour)gameObject.AddComponent<MoveDifferential>();
             break;
         case GlobalControl.motionModels.CAR:
             motionComponent = (MonoBehaviour)gameObject.AddComponent<MoveCar>();
             break;
     }
     motionModel = newMotionModel;
     return motionComponent;
 }
开发者ID:heuristicus,项目名称:DD2438,代码行数:25,代码来源:GlobalMove.cs

示例12: MapGenerator2

 public MapGenerator2(DungeonParameter param, MonoBehaviour obj,RndGenerator rnd)
 {
     DgParam = param;
     this.obj = obj;
     Rnd = rnd;
     reset();
 }
开发者ID:sgmtjp,项目名称:Git-SODATERUTOWER,代码行数:7,代码来源:MapGenerator2.cs

示例13: ProcessMessage

    void ProcessMessage(MonoBehaviour behaviour)
    {
        bool OpenCondition = true;
        bool NotYorButton = true;

        foreach (c2StateButton target in TriggerButtons){

            if (target == null) {continue;};

            if (target == behaviour){
                NotYorButton = false;
            }

            if (target.State != c2StateButton.eButtonState.On){
                OpenCondition = false;
                break;
            }

        }
        if (!NotYorButton){
            if (OpenCondition){
                animation.CrossFade("PullDown");

            }
            else{
                    animation.CrossFade("PullUp");
            }
        }
    }
开发者ID:qtLex,项目名称:Good_Evil_Level_1,代码行数:29,代码来源:CButtonAnimationController.cs

示例14: SimpleChat

 public SimpleChat(string identifier,MonoBehaviour currentMonoBehaviour,string senderName)
     : base(identifier,currentMonoBehaviour,senderName)
 {
     continueCheckMessages();
     rt = -messageTime;
     setReceiveFunction(receive);
 }
开发者ID:osijan,项目名称:cellule,代码行数:7,代码来源:testExtendClass.cs

示例15: Login

 public static Task Login(MonoBehaviour owner, IPEndPoint endPoint, string id, string password, Action<string> progressReport)
 {
     var task = new UnitySlimTaskCompletionSource<bool>();
     task.Owner = owner;
     owner.StartCoroutine(LoginCoroutine(endPoint, id, password, task, progressReport));
     return task;
 }
开发者ID:SaladLab,项目名称:TicTacToe,代码行数:7,代码来源:LoginProcessor.cs


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