本文整理汇总了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);
}
示例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);
}
}
示例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;
}
}
示例4: AddItemEditor
public AddItemEditor()
{
this.ge = ScriptableObject.CreateInstance<GameEvent> ();
ge.Name = this.EventName;
ge.setParameter ("item", null);
ge.setParameter ("inventory", null);
}
示例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);
}
}
示例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);
}
示例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);
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
示例11: Awake
void Awake()
{
for (int i = 0; i < eventNames.Length; i++) {
GameEvent gameEvent = new GameEvent();
AddEventToPool (eventNames[i], ref gameEvent);
}
}
示例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;
}
示例13: FilterEvent
private void FilterEvent(GameEvent gameEvent)
{
foreach (EventFilter filter in _filters)
{
filter.FilterEvent(gameEvent);
}
}
示例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);
}
}
示例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();
}
}