Пример #1
0
        protected override bool Initialize(Vehicle vehicle)
        {
            if (!base.Initialize(vehicle))
            {
                return(false);
            }

            gimbalController = vehicle.GetComponent <GimbalController>();

            return(gimbalController != null);
        }
Пример #2
0
        // Called when a module is mounted on one of the vehicle's module mounts.
        protected override void OnModuleMounted(Module module)
        {
            // Look for target leading weapons
            TargetLeader targetLeader = module.GetComponent <TargetLeader>();

            if (targetLeader != null)
            {
                if (!targetLeaders.Contains(targetLeader))
                {
                    targetLeaders.Add(targetLeader);

                    targetLeader.SetTarget(weaponsTargetSelector.SelectedTarget);

                    if (weaponsTargetSelector != null)
                    {
                        weaponsTargetSelector.onSelectedTargetChanged.AddListener(targetLeader.SetTarget);
                    }

                    onTargetLeaderLoaded.Invoke(targetLeader);
                }
            }

            // Look for locking weapons
            TargetLocker targetLocker = module.GetComponent <TargetLocker>();

            if (targetLocker != null)
            {
                if (!targetLockers.Contains(targetLocker))
                {
                    targetLockers.Add(targetLocker);

                    targetLocker.SetTarget(weaponsTargetSelector.SelectedTarget);

                    if (weaponsTargetSelector != null)
                    {
                        weaponsTargetSelector.onSelectedTargetChanged.AddListener(targetLocker.SetTarget);
                    }

                    onTargetLockerLoaded.Invoke(targetLocker);
                }
            }

            // Look for gimbaled weapons
            GimbalController gimbalController = module.GetComponentInChildren <GimbalController>();

            if (gimbalController != null)
            {
                if (!gimbaledWeapons.Contains(gimbalController))
                {
                    gimbaledWeapons.Add(gimbalController);
                }
            }
        }
Пример #3
0
 protected override bool Initialize()
 {
     if (cameraEntity != null)
     {
         cameraGimbalController = cameraEntity.GetComponent <GimbalController>();
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #4
0
        // Called when a module is mounted on one of the vehicle's module mounts.
        protected override void OnModuleMounted(Module module)
        {
            // Look for target leading weapons
            TargetLeader targetLeader = module.GetComponent <TargetLeader>();

            if (targetLeader != null)
            {
                if (!targetLeaders.Contains(targetLeader))
                {
                    targetLeaders.Add(targetLeader);

                    onTargetLeaderLoaded.Invoke(targetLeader);
                }
            }

            // Look for locking weapons
            TargetLocker targetLocker = module.GetComponent <TargetLocker>();

            if (targetLocker != null)
            {
                if (!targetLockers.Contains(targetLocker))
                {
                    targetLockers.Add(targetLocker);

                    onTargetLockerLoaded.Invoke(targetLocker);
                }
            }

            // Look for aim assists
            AimAssist aimAssist = module.GetComponent <AimAssist>();

            if (aimAssist != null)
            {
                if (!aimAssists.Contains(aimAssist))
                {
                    aimAssist.IndependentUpdate = aimAssistEnabled;
                    aimAssists.Add(aimAssist);
                }
            }

            // Look for gimbaled weapons
            GimbalController gimbalController = module.GetComponentInChildren <GimbalController>();

            if (gimbalController != null)
            {
                if (!gimbaledWeapons.Contains(gimbalController))
                {
                    gimbaledWeapons.Add(gimbalController);
                }
            }
        }
Пример #5
0
        // Called when a module is unmounted from one of the vehicle's module mounts.
        protected override void OnModuleUnmounted(Module module)
        {
            // Unlink target leading weapons
            TargetLeader targetLeader = module.GetComponent <TargetLeader>();

            if (targetLeader != null)
            {
                if (targetLeaders.Contains(targetLeader))
                {
                    targetLeader.SetTarget(null);
                    targetLeaders.Remove(targetLeader);

                    if (weaponsTargetSelector != null)
                    {
                        weaponsTargetSelector.onSelectedTargetChanged.RemoveListener(targetLeader.SetTarget);
                    }
                }
            }

            // Unlink target locking weapons
            TargetLocker targetLocker = module.GetComponent <TargetLocker>();

            if (targetLocker != null)
            {
                if (targetLockers.Contains(targetLocker))
                {
                    targetLocker.SetTarget(null);
                    targetLockers.Remove(targetLocker);

                    if (weaponsTargetSelector != null)
                    {
                        weaponsTargetSelector.onSelectedTargetChanged.RemoveListener(targetLocker.SetTarget);
                    }
                }
            }

            // Look for gimbaled weapons
            GimbalController gimbalController = module.GetComponentInChildren <GimbalController>();

            if (gimbalController != null)
            {
                if (gimbaledWeapons.Contains(gimbalController))
                {
                    gimbaledWeapons.Remove(gimbalController);
                }
            }
        }
Пример #6
0
        // Called when a module is unmounted from one of the vehicle's module mounts.
        protected override void OnModuleUnmounted(Module module)
        {
            // Unlink target leading weapons
            TargetLeader targetLeader = module.GetComponent <TargetLeader>();

            if (targetLeader != null)
            {
                if (targetLeaders.Contains(targetLeader))
                {
                    targetLeaders.Remove(targetLeader);
                }
            }

            // Unlink target locking weapons
            TargetLocker targetLocker = module.GetComponent <TargetLocker>();

            if (targetLocker != null)
            {
                if (targetLockers.Contains(targetLocker))
                {
                    targetLockers.Remove(targetLocker);
                }
            }

            // Unlink target locking weapons
            AimAssist aimAssist = module.GetComponent <AimAssist>();

            if (aimAssist != null)
            {
                if (aimAssists.Contains(aimAssist))
                {
                    aimAssists.Remove(aimAssist);
                }
            }

            // Look for gimbaled weapons
            GimbalController gimbalController = module.GetComponentInChildren <GimbalController>();

            if (gimbalController != null)
            {
                if (gimbaledWeapons.Contains(gimbalController))
                {
                    gimbaledWeapons.Remove(gimbalController);
                }
            }
        }