Пример #1
0
 public static RangeTypeConfigurationGameObject Get()
 {
     if (Instance == null)
     {
         Instance = FindObjectOfType <RangeTypeConfigurationGameObject>();
     }
     return(Instance);
 }
Пример #2
0
        public void InitializeEvents()
        {
            rangeRenderDatas            = new Dictionary <RangeTypeID, Dictionary <int, AbstractRangeRenderData> >();
            RangeTypeConfiguration      = RangeTypeConfigurationGameObject.Get().RangeRenderingConfiguration.RangeTypeConfiguration;
            MasterRangeMaterial         = new Material(RangeTypeConfigurationGameObject.Get().RangeRenderingConfiguration.MasterRangeShader);
            RangeRenderingConfiguration = RangeTypeConfigurationGameObject.Get().RangeRenderingConfiguration;

            #region Event Registering

            RangeEventsManager.Get().RegisterOnRangeObjectCreatedEventListener(OnRangeObjectCreated);

            #endregion
        }
Пример #3
0
        public void Init(LevelRangeEffectInherentData LevelRangeEffectInherentData)
        {
            #region Init Values

            rangeRenderDatas = new Dictionary <RangeTypeID, Dictionary <int, AbstractRangeRenderData> >();

            #endregion

            #region Event Registering

            RangeEventsManager.Get().RegisterOnRangeObjectCreatedEventListener(OnRangeObjectCreated);
            RangeEventsManager.Get().RegisterOnRangeObjectDestroyedEventListener(OnRangeObjectDestroyed);

            #endregion

            RangeTypeConfiguration      = RangeTypeConfigurationGameObject.Get().RangeRenderingConfiguration.RangeTypeConfiguration;
            MasterRangeMaterial         = new Material(RangeTypeConfigurationGameObject.Get().RangeRenderingConfiguration.MasterRangeShader);
            RangeRenderingConfiguration = RangeTypeConfigurationGameObject.Get().RangeRenderingConfiguration;

            RangeDrawCommand      = new CommandBuffer();
            RangeDrawCommand.name = GetType().Name + "." + nameof(RangeDrawCommand);

            AffectedGroundEffectsType = GameObject.FindObjectsOfType <GroundEffectType>().ToList();
            foreach (var affectedGroundEffectType in AffectedGroundEffectsType)
            {
                affectedGroundEffectType.Init();
            }


            //Do static batching of ground effects types
            StaticBatchingUtility.Combine(
                AffectedGroundEffectsType.ConvertAll(groundEffectType => groundEffectType.gameObject)
                .Union(AffectedGroundEffectsType.ConvertAll(groundEffectType => groundEffectType.AssociatedGroundEffectIgnoredGroundObjectType).SelectMany(s => s).ToList().ConvertAll(groundEffectIgnoredObject => groundEffectIgnoredObject.gameObject))
                .ToArray(), GameObject.FindWithTag(TagConstants.ROOT_CHUNK_ENVIRONMENT));

            //master range shader color level adjuster
            MasterRangeMaterial.SetFloat("_AlbedoBoost", 1f + LevelRangeEffectInherentData.DeltaIntensity);
            MasterRangeMaterial.SetFloat("_RangeMixFactor", 0.5f + LevelRangeEffectInherentData.DeltaMixFactor);
        }