예제 #1
0
    private GameObject Load(EffectEvent effect)
    {
        GameObject go = null;

        switch (effect.type)
        {
        case EffectType.Load:
            go = Instantiate(effect.data.effectObj, transform);
            go.transform.position = Camera.main.transform.position;
            break;

        case EffectType.ScreenChange:
            go = Instantiate(effect.data.effectObj, transform);
            go.transform.position = movieScreen.transform.position;
            movieScreen.SetActive(false);
            Invoke("ShowScreen", effect.end - effect.start);
            break;

        case EffectType.Poetry:
            go = Instantiate(effect.data.effectObj, transform);
            go.transform.position = movieScreen.transform.position;
            break;

        case EffectType.Flare:
            go = Instantiate(effect.data.effectObj);
            break;

        default:
            break;
        }
        loadedEffects.Add(go);
        return(go);
    }
예제 #2
0
    private IEnumerator PlayVideoEffct(EffectEvent effect)
    {
        if (effect != null)
        {
            float s;
            if (effect.start < 0f)
            {
                s = 0f;
            }
            else
            {
                s = effect.start;
            }
            yield return(new WaitForSeconds(s));

            GameObject temp = this.Load(effect);
            if (effect.end > 0 && effect.end > effect.start)
            {
                yield return(new WaitForSeconds(effect.end - effect.start));

                if (effect.type == EffectType.Poetry)
                {
                    temp.GetComponent <PoetryEffect>().FadeOut();
                }
                else
                {
                    Destroy(temp);
                }
            }
        }
    }
예제 #3
0
 void Start()
 {
     //     characterAnim = gameObject.GetComponent<CharacterAnimController>();
     controller  = GetComponent <CharacterControllerRB>();
     stats       = GetComponent <CharacterStats>();
     animator    = GetComponent <Animator>();
     effectEvent = gameObject.GetComponent <EffectEvent>();
     //    spells = GetComponentsInChildren<Spell>();
 }
예제 #4
0
    IEnumerator Play(Action action)
    {
        Action callBack = action;

        if (isBack)
        {
            if (time > MaxTime)
            {
                time = MaxTime;
            }
        }
        else
        {
            if (time < 0)
            {
                time = 0;
            }
        }
        while (true)
        {
            yield return(0);

            UpdateParticle(particleSystems0, time > MaxTime ? MaxTime : time);
            UpdateParticle(particleSystems1, time);
            if (isBack)
            {
                time -= Time.deltaTime * backSpeed;
                if (time < 0)
                {
                    if (callBack != null)
                    {
                        callBack();
                        callBack = null;
                    }
                }
            }
            else
            {
                time += Time.deltaTime * backSpeed;
                if (effectEvent != null && time > effectEvent.time)
                {
                    effectEvent.action.Invoke();
                    effectEvent = null;
                }
                if (time > MaxTime)
                {
                    if (callBack != null)
                    {
                        callBack();
                        callBack = null;
                    }
                }
            }
        }
    }
예제 #5
0
        public void onEffectEvent(EffectEvent e, Unit unit)
        {
            var fl = m_arrEffect[(int)e];

            if (fl != null)
            {
                foreach (var ef in fl)
                {
                    ef(this, unit);
                }
            }
        }
예제 #6
0
        public override void Activate(PlayerData player)
        {
            var effectEvent = new EffectEvent {
                Effect = Effect, IsRepeatable = IsRepeatable
            };

            player.Events.NextEpochEffects.Add(effectEvent);
            if (IsInstant)
            {
                Effect.Activate(player);
            }
        }
예제 #7
0
        private void On(EffectEvent e)
        {
            var p = e.Player;

            if (e.Enabled)
            {
                var effect = new ActiveEffect(e.Effect, e.Expires, e.TimeLeft, e.Duration);
                p.AddEffect(effect);
            }
            else
            {
                p.RemoveEffect(e.Effect);
            }
        }
예제 #8
0
        public static void EventHandler(string script)
        {
            var e = new EffectEvent(script);

            switch (script)
            {
            case BEFORE_EFFECT_APPLIED:     BeforeEffectApplied(e); break;

            case AFTER_EFFECT_APPLIED:      AfterEffectApplied(e); break;

            case BEFORE_EFFECT_REMOVED:     BeforeEffectRemoved(e); break;

            case AFTER_EFFECT_REMOVED:      AfterEffectRemoved(e); break;
            }
        }
예제 #9
0
        /// <summary>Applies the effect to its host.</summary>
        /// <remarks>Preconditions: this.Parent.Attributes must not be null if this.Parent is not null.</remarks>
        protected override void OnAddBehavior()
        {
            // Create and broadcast the event notifying players that the effect was applied.
            var addEvent = new EffectEvent(this.ActiveThing, this.Parent, this.SensoryMessage);

            this.ActiveThing.Eventing.OnCommunicationRequest(addEvent, EventScope.ParentsDown);
            if (!addEvent.IsCancelled)
            {
                this.ActiveThing.Eventing.OnCommunicationEvent(addEvent, EventScope.ParentsDown);
            }

            // Create and schedule an event that tells TimeSystem to call Expire()
            // after EndTime is reached.
            this.RemoveStatEvent = new TimeEvent(this.ActiveThing, this.Expire, this.EndTime, this.ExpirationMessage);
            TimeSystem.Instance.ScheduleEvent(this.RemoveStatEvent);
        }
예제 #10
0
        private void On(EffectEvent e)
        {
            var p = e.Player;

            if (e.Effect == Effect.Reset)
            {
                p.ResetAllEffects();
                return;
            }


            if (e.Enabled)
            {
                var effect = new ActiveEffect(e.Effect, e.Expires, e.TimeLeft, e.Duration);
                p.SetEffect(effect);
            }
            else
            {
                p.RemoveEffect(e.Effect);
            }
        }
예제 #11
0
        /// <summary>Called when a parent has just been assigned to this behavior.</summary>
        /// <remarks>
        /// This method first creates and broadcasts an event notifying users that
        /// the mute effect was applied. Then it creates another event that holds
        /// the Unmute method, and adds it to the TimeSystem scheduler to call
        /// after the duration time has passed.
        /// </remarks>
        protected override void OnAddBehavior()
        {
            // While this effect is attached to its parent, it denies all verbal communications from it.
            Interceptor = new CancellableGameEventHandler(DenyCommunicationRequest);
            Parent.Eventing.CommunicationRequest += Interceptor;

            // Create event and broadcast it to let the affected parties know the effect was applied.
            var muteEvent = new EffectEvent(ActiveThing, Parent, SensoryMessage);

            ActiveThing.Eventing.OnCommunicationRequest(muteEvent, EventScope.ParentsDown);
            if (!muteEvent.IsCancelled)
            {
                ActiveThing.Eventing.OnCommunicationEvent(muteEvent, EventScope.ParentsDown);
            }

            // Create an event to be broadcast when the mute effect expires,
            // and schedule it with the TimeSystem.
            UnmuteEvent = new TimeEvent(ActiveThing, Unmute, EndTime, ExpirationMessage);
            TimeSystem.Instance.ScheduleEvent(UnmuteEvent);

            base.OnAddBehavior();
        }
예제 #12
0
 public void Fuse(EffectEvent nextEvent)
 {
     StackParameter += nextEvent.SubEffect.Fuse(nextEvent.Performer, nextEvent.Target, nextEvent.Effect);
 }
예제 #13
0
 private void RegistEffectEvent(EffectEvent effect)
 {
     videoEffectCor = StartCoroutine(PlayVideoEffct(effect));
 }
예제 #14
0
 protected override AgentItem GetAgent(EffectEvent effectEvent)
 {
     return(effectEvent.Dst);
 }
예제 #15
0
 public void Add(EffectEvent effectEvent)
 {
     _effects.Add(effectEvent);
 }
 protected virtual AgentItem GetAgent(EffectEvent effectEvent)
 {
     return(effectEvent.Src);
 }