Пример #1
0
        public void CreateAndAttachRubbleToEntity(Entity entity)
        {
            SmartEntity smartEntity = (SmartEntity)entity;
            string      rubbleAssetNameForEntity = FXUtils.GetRubbleAssetNameForEntity(smartEntity);

            if (rubbleAssetNameForEntity != null)
            {
                GameObjectViewComponent gameObjectViewComp = smartEntity.GameObjectViewComp;
                GameUtils.ToggleGameObjectViewVisibility(gameObjectViewComp, false);
                Service.Get <AssetManager>().RegisterPreloadableAsset(rubbleAssetNameForEntity);
                this.CreateAndAttachFXToEntity(entity, rubbleAssetNameForEntity, "rubble", null, false, Vector3.zero, true);
            }
        }
Пример #2
0
        public void CreateRubbleAtEntityPosition(SmartEntity entity)
        {
            string rubbleAssetNameForEntity = FXUtils.GetRubbleAssetNameForEntity(entity);

            if (rubbleAssetNameForEntity != null)
            {
                GameObjectViewComponent gameObjectViewComp = entity.GameObjectViewComp;
                Vector3    position = gameObjectViewComp.MainTransform.position;
                float      y        = UnityEngine.Random.Range(0f, 360f);
                Quaternion rotation = Quaternion.Euler(0f, y, 0f);
                this.CreateFXAtPosition(rubbleAssetNameForEntity, position, rotation);
            }
        }