Exemplo n.º 1
0
        public VBattle(BattleParams param)
        {
            this.collider = GameObject.Find("Collider").GetComponent <BoxCollider>();
            this._rid     = param.id;
            this.data     = ModelFactory.GetBattleData(Utils.GetIDFromRID(this._rid));

            Camera mainCamera = GameObject.Find("Camera").GetComponent <Camera>();

            this.camera = new GodCamera(mainCamera, this.data.camera);
            this.input  = new PointerInput(mainCamera);
            this.input.RegisterInteractive(this);
            this.interaction = new Interaction(this);

            this._debugDrawer   = new DebugDrawer();
            this.graphicManager = new GraphicManager();
            this._entityManager = new VEntityManager(this);
            this._buffManager   = new VBuffManager(this);

            EventCenter.AddListener(SyncEventType.BATTLE_DESTROIED, this.HandleBattleDestroied);
            EventCenter.AddListener(SyncEventType.SPAWN_ENTITY, this.HandleSpawnEntity);
            EventCenter.AddListener(SyncEventType.DESPAWN_ENTITY, this.HandleDespawnEntity);
            EventCenter.AddListener(SyncEventType.ENTITY_ATTR_CHANGED, this.HandleEntityAttrChanged);
            EventCenter.AddListener(SyncEventType.SKILL_ATTR_CHANGED, this.HandleSkillAttrChanged);
            EventCenter.AddListener(SyncEventType.BUFF_ATTR_CHANGED, this.HandleBuffAttrChanged);
            EventCenter.AddListener(SyncEventType.ENTITY_ATTR_INITIALIZED, this.HandleEntityAttrInitialized);
            EventCenter.AddListener(SyncEventType.BUFF_ATTR_INITIALIZED, this.HandleBuffAttrInitialized);
            EventCenter.AddListener(SyncEventType.ENTITY_STATE_CHANGED, this.HandleEntityStateChanged);
            EventCenter.AddListener(SyncEventType.SPAWN_BUFF, this.HandleSpawnBuff);
            EventCenter.AddListener(SyncEventType.DESPAWN_BUFF, this.HandleDespawnBuff);
            EventCenter.AddListener(SyncEventType.ENTER_BUFF, this.HandleEnterBuff);
            EventCenter.AddListener(SyncEventType.EXIT_BUFF, this.HandleExitBuff);
            EventCenter.AddListener(SyncEventType.BUFF_TRIGGERED, this.HandleBuffTriggered);
            EventCenter.AddListener(SyncEventType.TRIGGER_TARGET, this.HandleTriggerTarget);
            EventCenter.AddListener(SyncEventType.BUFF_STATE_ADDED, this.HandleBuffStateAdded);
            EventCenter.AddListener(SyncEventType.BUFF_STATE_REMOVED, this.HandleBuffStateRemoved);
            EventCenter.AddListener(SyncEventType.BUFF_STATE_TRIGGERED, this.HandleBuffStateTriggered);
            EventCenter.AddListener(SyncEventType.ENTITY_RELIVE, this.HandleRelive);
            EventCenter.AddListener(SyncEventType.DAMAGE, this.HandleDamage);
            EventCenter.AddListener(SyncEventType.ENTITY_DIE, this.HandleEntityDie);
            EventCenter.AddListener(SyncEventType.MISSILE_COMPLETE, this.HandleMissileComplete);
            EventCenter.AddListener(SyncEventType.DEBUG_DRAW, this.HandleDebugDraw);
        }
Exemplo n.º 2
0
        protected override void InternalDispose()
        {
            EventCenter.RemoveListener(SyncEventType.BATTLE_DESTROIED, this.HandleBattleDestroied);
            EventCenter.RemoveListener(SyncEventType.SPAWN_ENTITY, this.HandleSpawnEntity);
            EventCenter.RemoveListener(SyncEventType.DESPAWN_ENTITY, this.HandleDespawnEntity);
            EventCenter.RemoveListener(SyncEventType.ENTITY_ATTR_CHANGED, this.HandleEntityAttrChanged);
            EventCenter.RemoveListener(SyncEventType.SKILL_ATTR_CHANGED, this.HandleSkillAttrChanged);
            EventCenter.RemoveListener(SyncEventType.BUFF_ATTR_CHANGED, this.HandleBuffAttrChanged);
            EventCenter.RemoveListener(SyncEventType.ENTITY_ATTR_INITIALIZED, this.HandleEntityAttrInitialized);
            EventCenter.RemoveListener(SyncEventType.BUFF_ATTR_INITIALIZED, this.HandleBuffAttrInitialized);
            EventCenter.RemoveListener(SyncEventType.ENTITY_STATE_CHANGED, this.HandleEntityStateChanged);
            EventCenter.RemoveListener(SyncEventType.SPAWN_BUFF, this.HandleSpawnBuff);
            EventCenter.RemoveListener(SyncEventType.DESPAWN_BUFF, this.HandleDespawnBuff);
            EventCenter.RemoveListener(SyncEventType.ENTER_BUFF, this.HandleEnterBuff);
            EventCenter.RemoveListener(SyncEventType.EXIT_BUFF, this.HandleExitBuff);
            EventCenter.RemoveListener(SyncEventType.BUFF_TRIGGERED, this.HandleBuffTriggered);
            EventCenter.RemoveListener(SyncEventType.TRIGGER_TARGET, this.HandleTriggerTarget);
            EventCenter.RemoveListener(SyncEventType.BUFF_STATE_ADDED, this.HandleBuffStateAdded);
            EventCenter.RemoveListener(SyncEventType.BUFF_STATE_REMOVED, this.HandleBuffStateRemoved);
            EventCenter.RemoveListener(SyncEventType.BUFF_STATE_TRIGGERED, this.HandleBuffStateTriggered);
            EventCenter.RemoveListener(SyncEventType.ENTITY_RELIVE, this.HandleRelive);
            EventCenter.RemoveListener(SyncEventType.DAMAGE, this.HandleDamage);
            EventCenter.RemoveListener(SyncEventType.ENTITY_DIE, this.HandleEntityDie);
            EventCenter.RemoveListener(SyncEventType.MISSILE_COMPLETE, this.HandleMissileComplete);
            EventCenter.RemoveListener(SyncEventType.DEBUG_DRAW, this.HandleDebugDraw);

            this._debugDrawer = null;
            this._entityManager.Dispose();
            this._buffManager.Dispose();
            this.interaction.Dispose();
            this.input.UnregisterInteractive(this);
            this.input.Dispose();
            this.graphicManager.Dispose();
            this.graphicManager = null;
            this._entityManager = null;
            this._buffManager   = null;
            this._context       = null;
            this.data           = null;

            base.InternalDispose();
        }