Пример #1
0
        protected virtual void OnHit(SceneObject receiver)
        {
            var _battleScene = LogicCore.SP.SceneManager.CurrentScene as BattleScene;

            EventManager.TriggerEvent(ProjectileAction.hitEvent, new RuntimeData(Sender, receiver, Data));
            EventGroup.FireEvent((int)ProjectileEvent.OnHit, this, null);
            _battleScene.RemoveSceneObject(this.Id);
        }
Пример #2
0
        public void SwitchScene(IScene battleScene)
        {
            if (CurrentScene != null)
            {
                CurrentScene.Destroy();
            }
            CurrentScene = battleScene;
            CurrentScene.Init();
            var arg = EventGroup.NewArg <EventSingleArgs <IScene> >();

            arg.value = battleScene;
            EventGroup.FireEvent((int)SceneManagerEvent.OnSwitchScene, this, arg);
        }
Пример #3
0
 public void Add(AttributeType at, Operation op, long value)
 {
     if (_attributes.ContainsKey((int)at))
     {
         var attr     = _attributes[(int)at];
         var oldValue = attr.FinalValue;
         attr.Add(op, value);
         EventGroup.FireEvent((int)Event.OnAttributechange, this, EventGroup.NewArg <EventSingleArgs <AttributeMsg>, AttributeMsg>(new AttributeMsg()
         {
             At       = at,
             NewValue = attr.FinalValue,
             OldValue = oldValue
         }));
     }
     else
     {
         Debug.LogError(at + " Key not exsit");
     }
 }
Пример #4
0
        public void SetBase(AttributeType at, long value)
        {
            CharacterAttribute attr;

            if (_attributes.TryGetValue((int)at, out attr))
            {
                var oldValue = attr.FinalValue;
                _attributes[(int)at].SetBase(value);
                EventGroup.FireEvent((int)Event.OnAttributechange, this, EventGroup.NewArg <EventSingleArgs <AttributeMsg>, AttributeMsg>(new AttributeMsg()
                {
                    At       = at,
                    NewValue = attr.FinalValue,
                    OldValue = oldValue
                }));
            }
            else
            {
                attr = New(at, value);
            }
        }
Пример #5
0
 public void FireEvent(int id, object sender, EventMsg m)
 {
     EventGroup.FireEvent(id, sender, m);
 }