Beispiel #1
0
        public TargetingController()
        {
            Service.Set <TargetingController>(this);
            this.pathingManager         = Service.Get <PathingManager>();
            this.shooterController      = Service.Get <ShooterController>();
            this.spatialIndexController = Service.Get <SpatialIndexController>();
            EntityController entityController = Service.Get <EntityController>();

            this.defensiveTroopNodeList  = entityController.GetNodeList <DefensiveTroopNode>();
            this.offensiveTroopNodeList  = entityController.GetNodeList <OffensiveTroopNode>();
            this.offensiveHealerNodeList = entityController.GetNodeList <OffensiveHealerNode>();
            this.defensiveHealerNodeList = entityController.GetNodeList <DefensiveHealerNode>();
        }
Beispiel #2
0
        public TargetingController()
        {
            Service.TargetingController = this;
            this.pathingManager         = Service.PathingManager;
            this.shooterController      = Service.ShooterController;
            this.spatialIndexController = Service.SpatialIndexController;
            EntityController entityController = Service.EntityController;

            this.defensiveTroopNodeList  = entityController.GetNodeList <DefensiveTroopNode>();
            this.offensiveTroopNodeList  = entityController.GetNodeList <OffensiveTroopNode>();
            this.offensiveHealerNodeList = entityController.GetNodeList <OffensiveHealerNode>();
            this.defensiveHealerNodeList = entityController.GetNodeList <DefensiveHealerNode>();
            EventManager eventManager = Service.EventManager;

            eventManager.RegisterObserver(this, EventId.ProcBuff);
            eventManager.RegisterObserver(this, EventId.RemovingBuff);
        }
Beispiel #3
0
        public void RotateGameObject(SmartEntity entity, float dx, float dz, float dt)
        {
            GameObjectViewComponent gameObjectViewComp = entity.GameObjectViewComp;
            TransformComponent      transformComp      = entity.TransformComp;

            if (entity.TroopComp != null && entity.TroopComp.TroopShooterVO.TargetSelf && transformComp.RotationInitialized)
            {
                return;
            }
            float                     num                     = transformComp.Rotation;
            bool                      flag                    = dx != 0f || dz != 0f;
            SmartEntity               smartEntity             = null;
            GameObjectViewComponent   gameObjectViewComponent = null;
            SecondaryTargetsComponent secondaryTargetsComp    = entity.SecondaryTargetsComp;
            ShooterComponent          shooterComp             = entity.ShooterComp;

            if (secondaryTargetsComp != null && shooterComp != null)
            {
                ShooterController shooterController = Service.Get <ShooterController>();
                smartEntity = shooterController.GetTroopTarget(secondaryTargetsComp, shooterComp);
                if (smartEntity != null && (gameObjectViewComponent = smartEntity.GameObjectViewComp) == null)
                {
                    smartEntity = shooterController.GetPrimaryTarget(shooterComp);
                    if (smartEntity != null)
                    {
                        gameObjectViewComponent = smartEntity.GameObjectViewComp;
                    }
                }
            }
            else
            {
                PathingComponent pathingComp = entity.PathingComp;
                if (pathingComp != null)
                {
                    smartEntity = pathingComp.Target;
                    if (smartEntity != null)
                    {
                        gameObjectViewComponent = smartEntity.GameObjectViewComp;
                    }
                }
            }
            bool flag2 = !transformComp.RotationInitialized;

            if (flag2 && smartEntity == null && (entity.DefenderComp != null || TroopController.IsEntityHealer(entity)))
            {
                gameObjectViewComp.MainGameObject.SetActive(true);
                transformComp.RotationInitialized = true;
            }
            else
            {
                bool flag3 = flag2 || entity.StateComp.CurState == EntityState.Attacking || entity.StateComp.CurState == EntityState.Turning;
                if (flag3 && gameObjectViewComponent != null)
                {
                    gameObjectViewComp.ComputeRotationToTarget(gameObjectViewComponent, ref num);
                    flag = false;
                    if (flag2)
                    {
                        gameObjectViewComp.MainGameObject.SetActive(true);
                        transformComp.Rotation            = num;
                        transformComp.RotationInitialized = true;
                    }
                }
            }
            if (flag)
            {
                num = Mathf.Atan2(dz, dx);
            }
            num = MathUtils.MinAngle(transformComp.Rotation, num);
            float num2       = (float)entity.WalkerComp.SpeedVO.RotationSpeed / 1000f;
            float smoothTime = 0.7853982f / num2;
            float num3       = (dt == 0f) ? transformComp.Rotation : Mathf.SmoothDampAngle(transformComp.Rotation, num, ref transformComp.RotationVelocity, smoothTime, num2, dt);

            num3 = MathUtils.WrapAngle(num3);
            gameObjectViewComp.Rotate(num3 + -1.57079637f);
            transformComp.Rotation = num3;
        }
 public AbstractAttackController()
 {
     this.shooterController = Service.Get <ShooterController>();
     this.boardController   = Service.Get <BoardController>();
 }
Beispiel #5
0
 public AbstractAttackController()
 {
     this.shooterController = Service.ShooterController;
     this.boardController   = Service.BoardController;
 }