public void OnTrapTriggered(Object p_sender, EventArgs p_args)
        {
            TrapEventArgs trapEventArgs = p_args as TrapEventArgs;
            GameMessage   item          = new GameMessage(LocaManager.GetText("TRAP_TRIGGERED", LocaManager.GetText(trapEventArgs.TrapEffect.Name)));

            m_queuedMessages.Enqueue(item);
        }
Exemple #2
0
        private void OnTrapTriggered(Object p_sender, EventArgs p_args)
        {
            TrapEventArgs trapEventArgs = p_args as TrapEventArgs;

            if (trapEventArgs != null && trapEventArgs.Trap == MyController)
            {
                EventHandler eventHandler = delegate(Object p_localSender, EventArgs p_localArgs)
                {
                    DelayedEventManager.InvokeEvent(EDelayType.ON_FX_HIT, EEventType.TRAP_TRIGGERED, p_sender, p_args);
                };
                String gfx = trapEventArgs.TrapEffect.GFX;
                if (!String.IsNullOrEmpty(gfx))
                {
                    FXQueue fxqueue = Helper.ResourcesLoad <FXQueue>(gfx, false);
                    if (fxqueue != null)
                    {
                        fxqueue = Helper.Instantiate <FXQueue>(fxqueue);
                        FXArgs args = new FXArgs(gameObject, gameObject, gameObject, gameObject, Vector3.zero, transform.forward, -transform.right, Vector3.zero);
                        fxqueue.Finished += eventHandler;
                        fxqueue.Execute(args);
                    }
                    else
                    {
                        eventHandler(this, EventArgs.Empty);
                        Debug.LogError("OnTrapTriggered: given GFX does not exist! " + gfx);
                    }
                }
                else
                {
                    eventHandler(this, EventArgs.Empty);
                    Debug.LogWarning("OnTrapTriggered: Trap GFX is missing!");
                }
            }
        }
        private void TrapEvent(Object p_sender, EventArgs p_args)
        {
            m_GetPriority = false;
            m_GotID       = false;
            TrapEventArgs trapEventArgs = (TrapEventArgs)p_args;

            if (trapEventArgs.BarkEventArgs == null)
            {
                return;
            }
            for (Int32 i = 0; i < trapEventArgs.BarkEventArgs.Length; i++)
            {
                BarkEventArgs barkEventArgs = trapEventArgs.BarkEventArgs[i];
                if (barkEventArgs != null)
                {
                    if (barkEventArgs.priority == 100 || (barkEventArgs.priority == 0 && !m_GotID))
                    {
                        m_GotID = true;
                        String text;
                        String text2;
                        GenerateAudioID(barkEventArgs.character, barkEventArgs.barkclip, out text, out text2);
                        if (!AudioController.IsPlaying(text2))
                        {
                            PlayBark(barkEventArgs.character.Index, text2);
                        }
                    }
                    else if (!m_GetPriority && !m_GotID)
                    {
                        m_Barklist.Add(barkEventArgs);
                    }
                }
                if (i == trapEventArgs.BarkEventArgs.Length - 1)
                {
                    m_GetPriority = true;
                }
            }
        }
Exemple #4
0
 /// <summary>
 /// Occurs when the trap is triggered.
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnTrapTriggeredEvent(TrapEventArgs e)
 {
     if (TriggerEvent != null && !Disabled)
         TriggerEvent(this, e);
 }