示例#1
0
        public static TargetReticle CreateTargetReticlePoolObject(IObjectPool <TargetReticle> objectPool)
        {
            TargetReticle targetReticle = new TargetReticle();

            targetReticle.Construct(objectPool);
            return(targetReticle);
        }
示例#2
0
        public EatResponse OnEvent(EventId id, object cookie)
        {
            Entity entity = null;

            if (id != EventId.TroopAcquiredFirstTarget)
            {
                if (id == EventId.SpecialAttackDeployed)
                {
                    SpecialAttack specialAttack = cookie as SpecialAttack;
                    TargetReticle fromPool      = this.GetFromPool(true);
                    fromPool.SetWorldTarget((float)specialAttack.TargetBoardX + 0.5f, (float)specialAttack.TargetBoardZ + 0.5f, specialAttack.VO.ReticleScale, specialAttack.VO.ReticleScale);
                    Service.ViewTimerManager.CreateViewTimer(specialAttack.VO.ReticleDuration, false, new TimerDelegate(this.DeactivateTargetReticle), fromPool);
                }
            }
            else
            {
                Entity        entity2       = cookie as Entity;
                TeamComponent teamComponent = entity2.Get <TeamComponent>();
                if (teamComponent != null && teamComponent.TeamType != TeamType.Attacker)
                {
                    return(EatResponse.NotEaten);
                }
                TroopComponent troopComponent = entity2.Get <TroopComponent>();
                if (troopComponent != null && troopComponent.TroopShooterVO.TargetSelf)
                {
                    return(EatResponse.NotEaten);
                }
                ShooterComponent shooterComponent = entity2.Get <ShooterComponent>();
                if (shooterComponent != null)
                {
                    entity = Service.ShooterController.GetPrimaryTarget(shooterComponent);
                }
                if (entity == null)
                {
                    return(EatResponse.NotEaten);
                }
                TargetReticle fromPool2 = this.GetFromPool(true);
                fromPool2.SetTarget(entity);
                Service.ViewTimerManager.CreateViewTimer(1.5f, false, new TimerDelegate(this.DeactivateTargetReticle), fromPool2);
            }
            return(EatResponse.NotEaten);
        }
示例#3
0
 public static void DeactivateTargetReticlePoolObject(TargetReticle targetReticle)
 {
     targetReticle.Deactivate();
 }
示例#4
0
 public unsafe static long $Invoke4(long instance, long *args)
 {
     TargetReticle.DeactivateTargetReticlePoolObject((TargetReticle)GCHandledObjects.GCHandleToObject(*args));
     return(-1L);
 }
示例#5
0
 public unsafe static long $Invoke1(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(TargetReticle.CreateTargetReticlePoolObject((IObjectPool <TargetReticle>)GCHandledObjects.GCHandleToObject(*args))));
 }