Ejemplo n.º 1
0
        private void CleanUpHitEffect(uint id, object cookie)
        {
            ImpactCookie impactCookie     = cookie as ImpactCookie;
            GameObject   impactGameObject = impactCookie.ImpactGameObject;

            this.ReturnImpactToPool(impactCookie.ImpactFaction, impactGameObject);
        }
Ejemplo n.º 2
0
        public void ApplyHitEffect(Entity building, Vector3 worldPosition)
        {
            GameObjectViewComponent gameObjectViewComponent = building.Get <GameObjectViewComponent>();

            if (gameObjectViewComponent == null)
            {
                return;
            }
            ShieldBuildingInfo shieldBuildingInfo = this.GetShieldBuildingInfo(building, ShieldLoadReason.ApplyHitEffect, worldPosition);

            if (shieldBuildingInfo == null)
            {
                return;
            }
            FactionType factionType = this.GetFactionType(building);
            GameObject  gameObject  = this.GetImpactFromPool(shieldBuildingInfo, factionType);

            if (gameObject == null)
            {
                return;
            }
            ParticleSystem component = gameObject.GetComponent <ParticleSystem>();

            gameObject = gameObject.transform.parent.gameObject;
            gameObject.transform.position = worldPosition;
            gameObject.transform.LookAt(gameObjectViewComponent.MainTransform);
            gameObject.SetActive(true);
            component.Play();
            ImpactCookie impactCookie = new ImpactCookie();

            impactCookie.ImpactGameObject = component.gameObject;
            impactCookie.ImpactFaction    = factionType;
            Service.ViewTimerManager.CreateViewTimer(1.2f, false, new TimerDelegate(this.CleanUpHitEffect), impactCookie);
        }