public LoggingAspectTransformation(LoggingAspectWeaver aspectWeaver, ILoggingBackend backend) : base(aspectWeaver) { this.backend = backend; this.assets = aspectWeaver.Module.Cache.GetItem(() => new Assets(aspectWeaver.Module)); }
public void LoadAssets() { if (null != this.assets) { return; } this.assets = new Assets(); this.assets.PlatformBottomSource = new BitmapImage(new Uri("Sprites\\Platform-Bottom.png", UriKind.Relative)); this.assets.PlatformTopSource = new BitmapImage(new Uri("Sprites\\Platform-Top.png", UriKind.Relative)); this.assets.PlatformInnerSource = new BitmapImage(new Uri("Sprites\\Platform-Inner.png", UriKind.Relative)); this.assets.CharacterSource = new BitmapSource[30]; int spriteWidth = 42; int spriteHeight = 51; System.Drawing.Rectangle croppedSource = new System.Drawing.Rectangle(0, 0, spriteWidth, spriteHeight); Bitmap source = System.Drawing.Image.FromFile("Sprites\\Character.png") as Bitmap; for (int row = 0; row < 5; row++) { for (int col = 0; col < 6; col++) { croppedSource.X = col * spriteWidth; croppedSource.Y = row * spriteHeight; Bitmap target = new System.Drawing.Bitmap((int)croppedSource.Width, (int)croppedSource.Height); Graphics.FromImage(target).DrawImage(source, new System.Drawing.Rectangle(0, 0, target.Width, target.Height), croppedSource, GraphicsUnit.Pixel); BitmapSource frame = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(target.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(target.Width, target.Height)); int index = row * 6 + col; this.assets.CharacterSource[index] = frame; } } }
public override void createTower(Assets.Scripts.Engine.Towers.Tower t) { base.createTower(t); targetMinions = new Minion[MAX_LASER_COUNT]; lineDrawers = new LineDrawer[MAX_LASER_COUNT]; for (int i = 0; i < targetMinions.Length; i++) { GameObject lineHolder = new GameObject("line_"+i); lineHolder.transform.parent = towerObject.transform; LineRenderer fish = lineHolder.AddComponent<LineRenderer>(); fish.material = new Material(rayMaterial); fish.SetWidth(0.02f, 0.02f); lineDrawers[i] = lineHolder.AddComponent<LineDrawer>(); lineDrawers[i].line = fish; lineDrawers[i].visible = false; lineDrawers[i].transforms = new Vector3[] { tower.getWorldMissileCreatePosition(), Vector3.zero }; lineDrawers[i].animationPeriod = 0.15f; lineDrawers[i].startColor = new Color(1f, 0f, 0f,0.36f); lineDrawers[i].endColor = new Color(0.39f, 0f, 0f, 0.7f); } }
public virtual void createMinion (Assets.Scripts.Engine.Minions.Minion minion) { this.minion = minion; minion.tag = this; minionObject = (GameObject)GameObject.Instantiate(childStaticMinionObject); minionObject.name = "m_" + minion.instanceId; healthBar = minionObject.transform.FindChild("HealthBar").gameObject.GetComponent<HealthBarDrawer>(); if (healthBar != null) { healthBar.health = (int) minion.stats.health; healthBar.maxHealth = (int) minion.stats.healthTotal; } animations = (Animation[]) minionObject.GetComponentsInChildren<Animation>(); foreach (Animation animation in animations) if(animation["walk"] != null) animation["walk"].speed = minion.stats.baseMovementSpeed * walkAnimationSpeedMultiplier(); rangeProjector = (Projector)GameObject.Instantiate(childStaticRangeProjector); rangeProjector.transform.parent = minionObject.transform; rangeProjector.transform.localPosition = new Vector3(0, 0.2f, 0); rangeProjector.orthographicSize = 0.2f; rangeProjector.enabled = false; soundPlayer = minionObject.AddComponent<AudioSource>(); soundPlayer.volume = 2; soundPlayer.rolloffMode = AudioRolloffMode.Linear; if (spawnSound == null) spawnSound = Resources.Load<AudioClip>("Sound/minion_spawn"); soundPlayer.clip = spawnSound; soundPlayer.Play(); }
private void AddAsset(Assets.Asset asset) { var item = new ListViewItem(asset.Name); item.Tag = asset; lvAssets.Items.Add(item); }
public void Init(Assets.Enemy enemy) { Health = enemy.Health; Shield = enemy.Shield; Credits = Health; ColorId = enemy.ColorId; _shootDelay = enemy.ShootDelay + (Random.Range(0, enemy.ShootDelay*2)); // Make enemies shoot a bit differently }
void SetInstance() { if(Instance == null) { Instance = this; } else { Debug.LogError("Creation of a second assets instance was attempted. It will be destroyed."); Destroy (this); } }
public Entity ReplaceAsteroid(Assets.Entitasteroids.Scripts.Sources.Features.Asteroid.AsteroidSize newSize) { var previousComponent = hasAsteroid ? asteroid : null; var component = _asteroidComponentPool.Count > 0 ? _asteroidComponentPool.Pop() : new Assets.Entitasteroids.Scripts.Sources.Features.Asteroid.AsteroidComponent(); component.size = newSize; ReplaceComponent(ComponentIds.Asteroid, component); if (previousComponent != null) { _asteroidComponentPool.Push(previousComponent); } return this; }
public HistogramDistanceTracker( string path, Assets.VirtualProfiler.GlobalConfiguration config, Transform targetA, Transform targetB) : base(path, config, new Color(0, 1, 0, 1)) { _targetA = targetA; _targetB = targetB; HistogramRenderer.FilePrefix = "DISTANCE"; }
public Entity ReplaceMood(Assets.Sources.GameLogic.Mood.Mood newMood) { var previousComponent = hasMood ? mood : null; var component = _moodComponentPool.Count > 0 ? _moodComponentPool.Pop() : new Assets.Sources.GameLogic.Mood.MoodComponent(); component.Mood = newMood; ReplaceComponent(ComponentIds.Mood, component); if (previousComponent != null) { _moodComponentPool.Push(previousComponent); } return this; }
public HistogramRenderer(string path, Assets.VirtualProfiler.GlobalConfiguration config, Color color) { _color = color; _config = config; _path = path + "/Histograms"; if (!Directory.Exists (_path)) { Directory.CreateDirectory (_path); } CreateBuffer (); }
public Entity ReplaceGameEventState(Assets.Sources.GameLogic.Components.EventState newEventState) { var previousComponent = hasGameEventState ? gameEventState : null; var component = _gameEventStateComponentPool.Count > 0 ? _gameEventStateComponentPool.Pop() : new Assets.Sources.GameLogic.Components.GameEventStateComponent(); component.EventState = newEventState; ReplaceComponent(ComponentIds.GameEventState, component); if (previousComponent != null) { _gameEventStateComponentPool.Push(previousComponent); } return this; }
public HistogramOrientationTracker( string path, Assets.VirtualProfiler.GlobalConfiguration config, Transform targetA, Transform targetB) : base(path, config, new Color(0, 0, 1, 1)) { _targetA = targetA; _targetB = targetB; HistogramRenderer.FilePrefix = "ORIENTATION"; }
public SegmentoPrimario(UnityEngine.GameObject puntoInterno, UnityEngine.GameObject puntoExterno, Plano planosMovimiento, Assets.ArticulacionType articulacion) { // TODO: Complete member initialization this.hombro = puntoInterno; this.codo = puntoExterno; this.planosMovimiento = planosMovimiento; base.articulacion = articulacion; Update(); }
protected object GetBOAssets(bool update = false) { IBusinessObjects BOAssets = (IBusinessObjects)this.Session["Assets"]; if (BOAssets == null || !(BOAssets is Assets) || update) { Session["Assets"] = null; BOAssets = (IBusinessObjects)Assets.GetAssets(); this.Session["Assets"] = BOAssets; } if (BOAssets == null || BOAssets.Count == 0) BOAssets = new Assets(); return BOAssets; }
internal static IEnumerable<TextureFrame> LoadAtals(Assets assets, string fileName) { if (string.IsNullOrWhiteSpace(fileName)) throw new ArgumentNullException(nameof(fileName)); var ext = Path.GetExtension(fileName).ToUpper(); AtlasLoader loader; if (!_loaders.TryGetValue(ext, out loader)) throw new Exception($"Loader for extension {ext} not registered"); var texture = assets.LoadTexture2D(Path.GetFileNameWithoutExtension(fileName)); var atalsData = assets.LoadText(fileName); return loader.LoadAtals(texture, atalsData); }
public void LoadHorizontal(Assets.Scripts.PerspectiveInitializer.ThemeState themeState) { transform.localPosition = new Vector3(-5.4f, 2.76f, 0.5f); transform.localRotation = Quaternion.Euler(0, 0, 0); transform.localScale = new Vector3(0.75f, 0.75f, 1); if (themeState == Assets.Scripts.PerspectiveInitializer.ThemeState.Mine) { GetComponent<Animator>().runtimeAnimatorController = dragon; pointLightColor = new Color(188, 85, 41, 255); } else { GetComponent<Animator>().runtimeAnimatorController = dragonIce; pointLightColor = new Color(41, 85, 188, 255); } }
public void LoadVertical(Assets.Scripts.PerspectiveInitializer.ThemeState themeState) { transform.localPosition = new Vector3(5.50f, 3.12f, 0.5f); transform.localRotation = Quaternion.Euler(0, 0, 270); transform.localScale = new Vector3(1, 1, 1); if (themeState == Assets.Scripts.PerspectiveInitializer.ThemeState.Mine) { GetComponent<Animator>().runtimeAnimatorController = dragon2; pointLightColor = new Color(188, 85, 41, 255); } else { GetComponent<Animator>().runtimeAnimatorController = dragon2Ice; pointLightColor = new Color(41, 85, 188, 255); } }
static void Main(string[] args) { Log.GlobalLevel = Log.Level.Debug; RenderWindow app = new RenderWindow(new VideoMode(800, 600), "HP!", Styles.Default, new ContextSettings(0, 0, 4)); app.SetFramerateLimit(60); app.Closed += delegate { app.Close(); }; app.SetVisible(true); app.SetActive(true); L.I("Assuming assets in \"assets\""); Assets assets = new Assets("assets"); LoadAnimations(assets); Level level1 = assets.Level("level1.json"); Game game = new Game(assets, level1); var view = new View(); int lastFrameTime = Environment.TickCount; while (app.IsOpen) { app.DispatchEvents(); float aspect = (float)app.Size.X / app.Size.Y; float targetWidth = 20, targetHeight = targetWidth / aspect; view.Reset(new FloatRect(0, 0, targetWidth, targetHeight)); app.SetView(view); int ticks = Environment.TickCount; float delta = (ticks - lastFrameTime) / 1000F; lastFrameTime = ticks; game.Update(delta); game.Render(app); app.Display(); } }
public Player(Assets assets) { Box = new BBAA(v2f(0, 0), v2f(0.8F, 0.8F)); anim = assets.Animation("cat"); anim.Scale = Box.Size; }
public Entity AddGameEventState(Assets.Sources.GameLogic.Components.EventState newEventState) { var component = _gameEventStateComponentPool.Count > 0 ? _gameEventStateComponentPool.Pop() : new Assets.Sources.GameLogic.Components.GameEventStateComponent(); component.EventState = newEventState; return AddComponent(ComponentIds.GameEventState, component); }
public virtual void addEffect (Assets.Scripts.Engine.Effects.MinionEffects.MinionEffect effect) { // TODO }
public AbstractHistogramTracker(string path, Assets.VirtualProfiler.GlobalConfiguration config, Color color) { _config = config; _histogramRenderer = new HistogramRenderer (path, config, color); }
public Entity SetGameState(Assets.Sources.GameLogic.Meta.GameState newGameState) { if (hasGameState) { throw new SingleEntityException(Matcher.GameState); } var entity = CreateEntity(); entity.AddGameState(newGameState); return entity; }
public Entity ReplaceGameState(Assets.Sources.GameLogic.Meta.GameState newGameState) { var entity = gameStateEntity; if (entity == null) { entity = SetGameState(newGameState); } else { entity.ReplaceGameState(newGameState); } return entity; }
void Manager_AssetAdded(object sender, Assets.AssetManagerEventArgs e) { var asset = e.Asset; //ignore if not in the current category var selectedCategory = this.GetSelectedCategory(); if ((selectedCategory != m_CategoryAll) && (e.Asset.Category != selectedCategory)) return; this.AddAsset(e.Asset); }
void CategoryManager_CategoryAdded(object sender, Assets.CategoryManagerEventArgs e) { cbCategories.Items.Add(e.Category); }
public BlockType LoadBlockType(Assets assets) { var sp = assets.Sprite(Sprite); sp.Scale = new Vector2f(1F / sp.Texture.Size.X, 1F / sp.Texture.Size.Y); return new BlockType(Name, sp, Collider, Friction); }
public StarMapView(StarMap gameObject, Assets assets) { _gameObject = gameObject; _assets = assets; }
public Game(Assets assets, Level level) { player = new Player(assets); player.Box.Position = level.Start; this.level = level; infoText = new Text("Foo", assets.Font("Ubuntu-R.ttf"), 20); infoText.Color = Color.Black; }