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


C# GameEvent类代码示例

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


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

示例1: SendEvent

 public void SendEvent(GameEvent gameEvent, IEventReceiver receiver)
 {
     SingletonFactory.LOG.Log("SendEvent: " + gameEvent.ToString() + (receiver == null ? "" : ", Receiver: " + receiver.ToString()), Logging.LoggerLevel.LOW);
     SingletonFactory.LOG.Log("EventArgs: " + gameEvent.ArgString);
     FilterEvent(gameEvent);
     receiver.OnEvent(gameEvent);
 }
开发者ID:WorldBeard,项目名称:worldbeardsource,代码行数:7,代码来源:EventHub.cs

示例2: AssignEvent

    //bool decisionMade;
    public void AssignEvent(GameEvent newEvent, MapRegion eventRegion, List<PartyMember> movedMembers)
    {
        GameEventManager.mainEventManager.drawingEvent=true;
        currentTeamRegion=eventRegion;
        teamList=movedMembers;
        assignedEvent=newEvent;
        descriptionText.text=newEvent.GetDescription(currentTeamRegion,teamList);
        //decisionMade=false;

        List<EventChoice> choices=newEvent.GetChoices(currentTeamRegion,teamList);
        if (choices!=null)
        {
            foreach (EventChoice choice in choices)
            {
                Button newButton=Instantiate(decisionButtonPrefab);
                newButton.transform.SetParent(transform.FindChild("Event Panel").FindChild("Decision Group"),false);
                //this is required, otherwise lambda listener only captures the last choice iteration
                newButton.GetComponentInChildren<Text>().text=choice.choiceTxt;
                newButton.interactable=!choice.grayedOut;
                newButton.onClick.AddListener(()=>ResolveChoice(newButton.GetComponentInChildren<Text>().text));
            }
        }
        else
        {
            //Create exit button
            Button newButton=Instantiate(decisionButtonPrefab);
            newButton.transform.SetParent(transform.FindChild("Event Panel").FindChild("Decision Group"),false);
            newButton.GetComponentInChildren<Text>().text="Close";
            newButton.onClick.AddListener(CloseChoiceScreen);
        }
    }
开发者ID:bitterpark,项目名称:unassumingrepo,代码行数:32,代码来源:EventCanvasHandler.cs

示例3: eventReceived

    ///////////////////////////////////////////////////////////////////////////
    // EVENT LISTENING
    ///////////////////////////////////////////////////////////////////////////
    public void eventReceived(GameEvent e)
    {
        if (e is PlayerMoveEvent)
        {

            KeyCode k = (e as PlayerMoveEvent).pressedKey;
            string strKeyPressed = k.ToString();

            switch (strKeyPressed){
            case "A":
                Flip ("left");
                anim.SetBool("Idle",false);
                anim.SetBool("WalkRight",false);
                anim.SetBool("WalkLeft",true);
                break;
            case "D":
                Flip ("right");
                anim.SetBool("Idle",false);
                anim.SetBool("WalkRight",true);
                anim.SetBool("WalkLeft",false);
                break;
            default:
                anim.SetBool("Idle",true);
                anim.SetBool("WalkRight",false);
                anim.SetBool("WalkLeft",false);
                break;
            }
        }

        if (e is PlayerActionEvent) {
            KeyCode k = (e as PlayerActionEvent).pressedKey;

        }
    }
开发者ID:matheusmig,项目名称:myUnitGame,代码行数:37,代码来源:PlayerAnimation.cs

示例4: AddItemEditor

 public AddItemEditor()
 {
     this.ge = ScriptableObject.CreateInstance<GameEvent> ();
     ge.Name = this.EventName;
     ge.setParameter ("item", null);
     ge.setParameter ("inventory", null);
 }
开发者ID:nvidiosin,项目名称:isoAbbeyTFG,代码行数:7,代码来源:AddItemEditor.cs

示例5: ClimbOverEdgeMove

	private void ClimbOverEdgeMove(GameEvent gEvent)
	{
		if(charState.IsClimbing() && gEvent == GameEvent.ClimbOverEdge && !noClimbOver)
		{
//			LeanTweenPath path = new LeanTweenPath();
//			LeanTweenVisual tween = new LeanTweenVisual();
////
			if (charState.IsVineClimbing())
			{
//				tween = vineTween;
//				path = vinePath;
//				print("ClimbOverVine: should start climbing over vine");
			}
			else if(charState.IsEdgeClimbing())
			{
//				tween = edgeTween;
//				path = edgePath;
			}

			//EnableClimbOverTween(path, tween, true);

			//path.transform.parent = null;
			animator.SetTrigger("ClimbOverEdge");

			RSUtil.Instance.DelayedAction(() => {
				//path.transform.parent = transform;
				//path.transform.localPosition = Vector3.zero;
				//EnableClimbOverTween(path, tween, false);
				EventManager.OnCharEvent(GameEvent.FinishClimbOver);
				noClimbOver = false;
			}, tweenDuration);

		}
	}
开发者ID:pencilking2002,项目名称:TOF_Movement_Protype,代码行数:34,代码来源:ClimbOverEdge.cs

示例6: NewEvent

 // Initial cost for employees is one weeks pay
 public void NewEvent(int EventIndex)
 {
     GameEvent NewEvent = new GameEvent ();
     NewEvent.EventIndex = EventIndex;
     switch (EventIndex) {
         case (0):	// patients give money
             NewEvent.EventText = "Application: Patient" + "\n" +
                                 "Name: Steve" + "\n" +
                                 "Income: $300" + "\n" +
                                 "Condition: Alchoholism";
             NewEvent.CashBonus = 300;
             break;
         case (1):	// guards cost money
             NewEvent.EventText = "Application: Guard" + "\n" +
                                 "Name: Dezlo" + "\n" +
                                 "Cost: $1050" + "\n" +
                                 "Salary: $150 Per Day";
             NewEvent.CashBonus = -1050;
             break;
         case (2):	// doctors cost money
             NewEvent.EventText = "Application: Doctor" + "\n" +
                                 "Name: Leviathan" + "\n" +
                                 "Cost: $2100" + "\n" +
                                 "Salary: $300 Per Day";
             NewEvent.CashBonus = -2100;
             break;
     }
     MyEvents.Add (NewEvent);
 }
开发者ID:xxcozzwozzaxx,项目名称:AsylumFULL,代码行数:30,代码来源:EventsManager.cs

示例7: eventReceived

    ///////////////////////////////////////////////////////////////////////////
    // EVENT LISTENING
    //////////////////////////////////////////////////////////////////////////
    public void eventReceived(GameEvent e)
    {
        if (e is NPCHealthEvent) {
            NPCHealthEvent evento = (e as NPCHealthEvent);

            ///////////////////////////////////////
            /// Confere se foi o monstro alvo
            var selfID = gameObject.GetInstanceID();
            if (selfID == evento.NPCInstanceID){

                NPCHealthChange = evento.NPCHealth;

                if ((NPCHealthLvl >= NPCMaxHealth / 2) && (NPCHealthLvl+NPCHealthChange < NPCMaxHealth / 2))
                    GameEventManager.post(new NPCStateEvent(selfID, 2)); //dispara o evento de transformação do inimigo em Vegetal. Esse evento será disparado com o efeito do antidoto

                if ((NPCHealthLvl < NPCMaxHealth / 2) && (NPCHealthLvl + NPCHealthChange >= NPCMaxHealth / 2))
                    GameEventManager.post(new NPCStateEvent(selfID, 1)); //dispara o evento de transformação do vegetal em Inimigo. Esse evento será disparado pelo efeito do veneno no ataque dos inimigos no vegetal, que poderá transformar-lo novamente em vegetalInimigo

                NPCHealthLvl += NPCHealthChange;
                if (NPCHealthLvl <= 0){
                    Die ();
                    NPCHealthLvl = 0;
                }

                ///////////////////////////////////////////////////////////////////
                /// Exibe Dano
                var selfTransform = GetComponent<Transform> ();
                DamagePopUp.ShowMessage (NPCHealthChange.ToString(), selfTransform.position);
            }
        }
    }
开发者ID:matheusmig,项目名称:myUnitGame,代码行数:34,代码来源:NPCHealth.cs

示例8: eventHappened

 public override void eventHappened(GameEvent ge)
 {
     if(ge.getParameter("Inventory") == this || ge.getParameter("Inventory") == this.Entity.gameObject)
     {
         Item item = (Item)ge.getParameter("Item");
         switch (ge.Name.ToLower())
         {
         case "open inventory":
             openInventory = true;
             events.Add(ge);
             break;
         case "add item":
             itemsToAdd.Add (item);
             events.Add(ge);
             break;
         case "remove item":
             itemsToRemove.Add(item);
             events.Add(ge);
             break;
         case "use item":
             itemsToUse.Add(item);
             events.Add(ge);
             break;
         }
     }
 }
开发者ID:nvidiosin,项目名称:isoAbbeyTFG,代码行数:26,代码来源:Inventory.cs

示例9: eventReceived

    ///////////////////////////////////////////////////////////////////////////
    // EVENT LISTENING
    ///////////////////////////////////////////////////////////////////////////
    public void eventReceived(GameEvent e)
    {
        if (e is PlayerActionEvent)
        {
            KeyCode pressedKey = (e as PlayerActionEvent).pressedKey;

            switch (pressedKey){
                case KeyCode.Space:
                    Debug.Log ("ESPAÇOOOOOOOOOOOOOOOOOOO");
                    break;
                case KeyCode.UpArrow:
                    FireBullet("Up");
                    break;
                case KeyCode.LeftArrow:
                    FireBullet("Left");
                    break;
                case KeyCode.RightArrow:
                    FireBullet("Right");
                    break;
                case KeyCode.DownArrow:
                    FireBullet("Down");
                    break;
                default :
                    Debug.Log(pressedKey.GetTypeCode());
                    break;
            }
        }
    }
开发者ID:matheusmig,项目名称:myUnitGame,代码行数:31,代码来源:PlayerAction.cs

示例10: GetEventFromPool

 //Out's a game event if it exists otherwise it will out null
 public void GetEventFromPool(string key, out GameEvent gameEvent)
 {
     if (_eventDictionary.ContainsKey (key))
         gameEvent = _eventDictionary [key];
     else
         gameEvent = null;
 }
开发者ID:Nodgez,项目名称:Sneaky-Blocks,代码行数:8,代码来源:EventPool.cs

示例11: Awake

 void Awake()
 {
     for (int i = 0; i < eventNames.Length; i++) {
         GameEvent gameEvent = new GameEvent();
         AddEventToPool (eventNames[i], ref gameEvent);
     }
 }
开发者ID:Nodgez,项目名称:Sneaky-Blocks,代码行数:7,代码来源:EventPool.cs

示例12: AddEventToPool

 //Adds a game event to the collection of events if it does not exist
 //or replaces the event with the Key if it does exist
 public void AddEventToPool(string key, ref GameEvent gameEvent)
 {
     if (!_eventDictionary.ContainsKey (key))
         _eventDictionary.Add (key, gameEvent);
     else
         _eventDictionary [key] = gameEvent;
 }
开发者ID:Nodgez,项目名称:Sneaky-Blocks,代码行数:9,代码来源:EventPool.cs

示例13: FilterEvent

 private void FilterEvent(GameEvent gameEvent)
 {
     foreach (EventFilter filter in _filters)
     {
         filter.FilterEvent(gameEvent);
     }
 }
开发者ID:WorldBeard,项目名称:worldbeardsource,代码行数:7,代码来源:EventHub.cs

示例14: Execute

 public override void Execute(GameEvent gameEvent)
 {
     bool finished = false;
     GameObject actor = null;
     if(this.show3)
     {
         actor = (GameObject)gameEvent.spawnedPrefabs[this.actorID];
     }
     else
     {
         actor = gameEvent.actor[this.actorID].GetActor();
     }
     if(actor != null)
     {
         ActorEventMover comp = actor.gameObject.GetComponent<ActorEventMover>();
         if(comp == null)
         {
             comp = actor.gameObject.AddComponent<ActorEventMover>();
         }
         Vector3 target = this.v3;
         if(this.show2) target = actor.transform.TransformDirection(target);
         comp.StartCoroutine(comp.MoveToDirection(actor.transform, this.controller, target, this.show, this.speed, this.time));
         if(this.wait)
         {
             finished = true;
             gameEvent.StartTime(this.time, this.next);
         }
     }
     if(!finished)
     {
         gameEvent.StepFinished(this.next);
     }
 }
开发者ID:hughrogers,项目名称:RPGQuest,代码行数:33,代码来源:MoveSteps.cs

示例15: ApplyEvent

    public override void ApplyEvent(GameWorldController gameWorldController, GameEvent.OnEventCompleteDelegate onComplete)
    {
        base.ApplyEvent(gameWorldController, onComplete);

        EnergyTankEntity energyTankEntity = gameWorldController.Model.GetEnergyTankEntity(EnergyTankId);

        energyTankEntity.Energy = (uint)Math.Max((int)energyTankEntity.Energy - EnergyDrained, 0);

        if (DrainerFaction == GameConstants.eFaction.ai)
        {
            MobEntity mobEntity = gameWorldController.Model.GetMobEntity(DrainerId);

            mobEntity.Energy = mobEntity.Energy + EnergyDrained;
        }
        else if (DrainerFaction == GameConstants.eFaction.player)
        {
            CharacterEntity characterEntity = gameWorldController.Model.GetCharacterEntity(DrainerId);

            characterEntity.Energy = characterEntity.Energy + EnergyDrained;
        }

        // Completes immediately
        if (onComplete != null)
        {
            onComplete();
        }
    }
开发者ID:ltloibrights,项目名称:AsyncRPG,代码行数:27,代码来源:GameEvent_EnergyTankDrained.cs


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