private void Awake() { //Find list of meshes and materials from prefab _referencePrefab = _prefab.LoadAndInstantiatePrefab(this.transform); _referencePrefab.SetActive(false); if (_referencePrefab != null) { _skinnedMeshes = _referencePrefab.GetComponentsInChildren <SkinnedMeshRenderer>(); for (int i = 0; i < _skinnedMeshes.Length; i++) { _skinnedMeshes[i].sharedMesh = AnimationTexture.AddExtraMeshData(_skinnedMeshes[i].sharedMesh); for (int j = 0; j < _skinnedMeshes[i].sharedMaterials.Length; j++) { _animationTexture.SetMaterialProperties(_skinnedMeshes[i].sharedMaterials[j]); } } } _renderedObjects = new List <RenderData>(kMaxMeshes); _instanceData = new InstanceData[kMaxMeshes]; _renderData = new RenderData[kMaxMeshes]; for (int i = 0; i < _renderData.Length; i++) { _renderData[i] = new RenderData(); } _renderedObjectTransforms = new Matrix4x4[kMaxMeshes]; _currentFrame = new float[kMaxMeshes]; _propertyBlock = new MaterialPropertyBlock(); }
private void LoadIfNeeded() { if (_animationTexture == null && _asset != null) { _animationTexture = AnimationTexture.LoadFromFile(_asset); } }
protected override void InitialiseIfNeeded() { base.InitialiseIfNeeded(); if (_particleCustomData == null) { for (int i = 0; i < _materials.Length; i++) { _animationTexture.SetMaterialProperties(_materials[i]); } _mesh = AnimationTexture.AddExtraMeshData(_mesh, 4); _particleCurrentFrame = new float[_particles.Length]; _particleCustomData = new List <Vector4>(_particles.Length); ParticleSystem.CustomDataModule customData = _particleSystem.customData; customData.SetMode(_customDataChannel, ParticleSystemCustomDataMode.Vector); customData.SetVector(_customDataChannel, 0, new ParticleSystem.MinMaxCurve(kDefaultData.x)); customData.SetVector(_customDataChannel, 1, new ParticleSystem.MinMaxCurve(kDefaultData.y)); customData.SetVector(_customDataChannel, 2, new ParticleSystem.MinMaxCurve(kDefaultData.z)); customData.SetVector(_customDataChannel, 3, new ParticleSystem.MinMaxCurve(kDefaultData.w)); } }
public static AnimationTexture[,] GetAnimationTextureArray(ISprite spriteSheet, Size size, int borderSizeX, int borderSizeY, Rectangle source) { int w = (source.Width + borderSizeX) / size.Width; int h = (source.Height + borderSizeY) / size.Height; var textures = new AnimationTexture[w, h]; int posX = source.X; int posY = source.Y; for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { var t = new AnimationTexture(); t.SourceRect = new Rectangle(posX, posY, size.Width, size.Height); t.Texture = spriteSheet; textures[x, y] = t; posY += size.Height + borderSizeY; } posX += size.Width + borderSizeX; posY = 0; } return(textures); }
static AnimationTexture() { AnimationTexture empty = new AnimationTexture(); empty.IsEmpty = true; Empty = empty; }
private void ReadTexture(BinaryReader reader, string prefabName) { TextureFormat format = TextureFormat.RGBAHalf; if (SystemInfo.graphicsDeviceType == UnityEngine.Rendering.GraphicsDeviceType.OpenGLES2) { //todo format = TextureFormat.RGBA32; } int count = reader.ReadInt32(); int blockWidth = reader.ReadInt32(); int blockHeight = reader.ReadInt32(); AnimationTexture aniTexture = new AnimationTexture(); aniTexture.boneTexture = new Texture2D[count]; aniTexture.name = prefabName; aniTexture.blockWidth = blockWidth; aniTexture.blockHeight = blockHeight; animationTextureList.Add(aniTexture); for (int i = 0; i != count; ++i) { int textureWidth = reader.ReadInt32(); int textureHeight = reader.ReadInt32(); int byteLength = reader.ReadInt32(); byte[] b = new byte[byteLength]; b = reader.ReadBytes(byteLength); Texture2D texture = new Texture2D(textureWidth, textureHeight, format, false); texture.LoadRawTextureData(b); texture.filterMode = FilterMode.Point; texture.Apply(); aniTexture.boneTexture[i] = texture; } }
public static CollisionSolver CheckCollision(Vector2 pos1, Vector2 pos2, AnimationTexture collider1, AnimatedSpriteSheet collider2, TimeSpan now, bool perPixel) { CollisionSolver solver = new CollisionSolver(); collisionType = "Bounding-Box"; Texture2D texture = collider1.getCurrentFrame(now); Rectangle collider1Range = new Rectangle(0, 0, texture.Width, texture.Height); Texture2D ss = collider2.getSpriteSheet(); Rectangle collider2Range = collider2.getCurrentFrame(now); collider1Range.X = (int)pos1.X; collider1Range.Y = (int)pos1.Y; collider2Range.X = (int)pos2.X; collider2Range.Y = (int)pos2.Y; //Simple Bounding Box Collisions if ((collider1Range.Left > collider2Range.Right && collider1Range.Right > collider2Range.Left) || (collider2Range.Left > collider1Range.Right && collider2Range.Right > collider1Range.Left) || (collider1Range.Top < collider2Range.Bottom && collider1Range.Bottom < collider2Range.Top) || (collider2Range.Top < collider1Range.Bottom && collider2Range.Bottom < collider1Range.Top)) { solver.collided = false; return(solver); } else { solver.collided = true; if (collider1Range.Right > collider2Range.Left && collider1Range.Left < collider2Range.Right) { if (collider1Range.Center.X < collider2Range.Center.X) { solver.correctionVector.X = (collider1Range.Right - collider2Range.Left) * -1.0f; } else { solver.correctionVector.X = (collider2Range.Right - collider1Range.Left); } } if (collider1Range.Bottom > collider2Range.Top && collider1Range.Top < collider2Range.Bottom) { if (collider1Range.Center.Y > collider2Range.Center.Y) { solver.correctionVector.Y = (collider2Range.Top - collider1Range.Bottom) * -1.0f; } else { solver.correctionVector.Y = (collider2Range.Top - collider1Range.Bottom); } } return(solver); } }
int GetPackageCount(VertexCache vertexCache) { int packageCount = 1; if (vertexCache.boneTextureIndex >= 0) { AnimationTexture texture = animationTextureList[vertexCache.boneTextureIndex]; packageCount = texture.boneTexture.Length; } return(packageCount); }
public static Animation GetSingleTextureAnimation(string name, AnimationTexture animationTexture) { animationTexture.SetTime(0, 1); var anim = new Animation(name, new AnimationTexture[] { animationTexture }); anim._PlayTime = 1000; anim.Width = animationTexture.SourceRect.Width; anim.Height = animationTexture.SourceRect.Height; return(anim); }
private int FindTexture_internal(string name) { for (int i = 0; i != animationTextureList.Count; ++i) { AnimationTexture texture = animationTextureList[i] as AnimationTexture; if (texture.name == name) { return(i); } } return(-1); }
// ------------------------------------------------------------------------------------ // public override void initialize() { // initialize model renderer.material.mainTexture = ResourcesBase.load("Textures/Items/Star", true) as Texture; gameObject.transform.localScale = new Vector3 (128, 1.0f, 128); // initialize model animation animationTexture = AnimationTexture.createNewInstance(gameObject, 6, 6, 20); // initialize physics PhysicsBase.addBoxCollider(gameObject, new Vector3 (0.01f,1.0f,0.01f), Vector3.zero); PhysicsBase.addRigidbody(gameObject); }
public static Animation GetSingleTextureAnimation(string name, ISprite texture) { AnimationTexture animationTexture = new AnimationTexture(); animationTexture.SetTime(0, 1); animationTexture.Position = new Vector2(0, 0); animationTexture.SourceRect = new Rectangle(0, 0, texture.Width, texture.Height); animationTexture.Texture = texture; var anim = new Animation(name, new AnimationTexture[] { animationTexture }); anim._PlayTime = 1000; anim.Width = texture.Width; anim.Height = texture.Height; return(anim); }
public void PreparePackageMaterial(InstancingPackage package, VertexCache vertexCache, int aniTextureIndex) { if (vertexCache.boneTextureIndex < 0) { return; } for (int i = 0; i != package.subMeshCount; ++i) { AnimationTexture texture = animationTextureList[vertexCache.boneTextureIndex]; package.material[i].SetTexture("_boneTexture", texture.boneTexture[aniTextureIndex]); package.material[i].SetInt("_boneTextureWidth", texture.boneTexture[aniTextureIndex].width); package.material[i].SetInt("_boneTextureHeight", texture.boneTexture[aniTextureIndex].height); package.material[i].SetInt("_boneTextureBlockWidth", texture.blockWidth); package.material[i].SetInt("_boneTextureBlockHeight", texture.blockHeight); } }
// ------------------------------------------------------------------------------------ // public override void initialize() { // initialize model unitModelImage = UnitModel.createNewInstance(gameObject); unitModelImage.addTexture(ResourcesBase.load("Textures/Units/Pony", true) as Texture, UnitModelTextureType.Normal); unitModelImage.addTexture(ResourcesBase.load("Textures/Units/PonyActive", true) as Texture, UnitModelTextureType.Active); unitModelImage.addTexture(ResourcesBase.load("Textures/Units/PonyBehindFence", true) as Texture, UnitModelTextureType.BehindFence); unitModelImage.setModelTexture(UnitModelTextureType.Normal); unitModelImage.setModelSize(110,150); // initialize model animation animationTexture = AnimationTexture.createNewInstance(gameObject, 12, 1, 20); // initialize physics PhysicsBase.addBoxCollider(gameObject, new Vector3 (0.01f,1.0f,0.01f), Vector3.zero); PhysicsBase.addRigidbody(gameObject); // initialize state setUnitState(new UnitStateQuiescence()); }
private static void SaveAnimationTexture(AnimationTexture animationTexture, string fileName) { string directory = Path.GetDirectoryName(fileName); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } FileStream file = File.Open(fileName, FileMode.Create); BinaryWriter writer = new BinaryWriter(file); writer.Write(animationTexture._numBones); writer.Write(animationTexture._animations.Length); for (int i = 0; i < animationTexture._animations.Length; i++) { writer.Write(animationTexture._animations[i]._name); writer.Write(animationTexture._animations[i]._startFrameOffset); writer.Write(animationTexture._animations[i]._totalFrames); writer.Write(animationTexture._animations[i]._fps); writer.Write((int)animationTexture._animations[i]._wrapMode); } //Write texture! byte[] bytes = animationTexture._texture.GetRawTextureData(); writer.Write(animationTexture._texture.width); writer.Write(animationTexture._texture.height); writer.Write(bytes.Length); writer.Write(bytes); file.Close(); #if UNITY_EDITOR //Refresh the saved asset AssetUtils.RefreshAsset(fileName); #endif }
// Use this for initialization void Start() { spawn = transform.position; gestion = Camera.main.GetComponent<DrawPath>(); gravity = gestion.gravityState; anim = gameObject.GetComponent<AnimationTexture>(); }
private void Start() { _skinnedMesh.sharedMesh = AnimationTexture.AddExtraMeshData(_skinnedMesh.sharedMesh); _animationTexture.SetMaterialProperties(_material); }
private VertexCache CreateVertexCache(string prefabName, int renderName, int alias, Mesh mesh) { VertexCache vertexCache = new VertexCache(); int cacheName = renderName + alias; vertexCachePool[cacheName] = vertexCache; vertexCache.nameCode = cacheName; vertexCache.mesh = mesh; vertexCache.boneTextureIndex = FindTexture_internal(prefabName); #if USE_CONSTANT_BUFFER vertexCache.weight = new Vector4[mesh.vertexCount]; vertexCache.boneIndex = new Vector4[mesh.vertexCount]; int packageCount = 1; if (vertexCache.boneTextureIndex >= 0) { AnimationTexture texture = animationTextureList[vertexCache.boneTextureIndex]; packageCount = texture.boneTexture.Length; } vertexCache.packageList = new List <VertexCache.InstancingPackage> [packageCount]; for (int i = 0; i != vertexCache.packageList.Length; ++i) { vertexCache.packageList[i] = new List <VertexCache.InstancingPackage>(); } vertexCache.runtimePackageIndex = new int[packageCount]; InstanceData data = null; int instanceName = prefabName.GetHashCode() + alias; if (!instanceDataPool.TryGetValue(instanceName, out data)) { data = new InstanceData(); data.worldMatrix = new List <Matrix4x4[]> [packageCount]; data.frameIndex = new List <float[]> [packageCount]; for (int i = 0; i != packageCount; ++i) { data.worldMatrix[i] = new List <Matrix4x4[]>(); data.frameIndex[i] = new List <float[]>(); } instanceDataPool.Add(instanceName, data); } vertexCache.instanceData = data; #else ++vertexCache.instancingCount; //vertexCache.indexCount = new uint[m.subMeshCount]; vertexCache.args = new uint[mesh.subMeshCount][]; vertexCache.vertex = new InstancingVertex[mesh.vertexCount]; vertexCache.bufArgs = new ComputeBuffer[mesh.subMeshCount]; vertexCache.instanceMaterial = new Material[mesh.subMeshCount]; vertexCache.subMeshCount = mesh.subMeshCount; uint startIndex = 0; for (int j = 0; j != mesh.subMeshCount; ++j) { vertexCache.args[j] = new uint[5]; vertexCache.bufArgs[j] = new ComputeBuffer(1, vertexCache.args[j].Length * sizeof(uint), ComputeBufferType.IndirectArguments); vertexCache.args[j][0] = mesh.GetIndexCount(j); vertexCache.args[j][2] = startIndex; startIndex = vertexCache.args[j][0]; vertexCache.bufArgs[j].SetData(vertexCache.args[j]); vertexCache.instanceMaterial[j] = new Material(renderer.materials[j]); vertexCache.instanceMaterial[j].DisableKeyword("USE_CONSTANT_BUFFER"); vertexCache.instanceMaterial[j].EnableKeyword("USE_COMPUTE_BUFFER"); AnimationTexture texture = animationTextureList[vertexCache.boneTextureIndex] as AnimationTexture; vertexCache.instanceMaterial[j].SetTexture("_boneTexture", texture.boneTexture); //vertexCache.instanceMaterial[j].SetTexture("_albedoTexture", renderer.materials[j].GetTexture("_MainTex")); vertexCache.instanceMaterial[j].SetInt("_boneTextureBlockWidth", texture.blockWidth); vertexCache.instanceMaterial[j].SetInt("_boneTextureBlockHeight", texture.blockHeight); vertexCache.instanceMaterial[j].SetInt("_boneTextureWidth", texture.boneTexture.width); vertexCache.instanceMaterial[j].SetInt("_boneTextureHeight", texture.boneTexture.height); } #endif return(vertexCache); }
public static CollisionSolver CheckCollision(Vector2 pos1, Vector2 pos2, AnimationTexture collider1, AnimationTexture collider2, TimeSpan now, bool perPixel) { return(CheckCollision(pos1, pos2, collider1.getCurrentFrame(now), collider2.getCurrentFrame(now), perPixel)); }
public void UnloadTexture() { _animationTexture = null; }
// Use this for initialization void Start() { anim = gameObject.GetComponent<AnimationTexture>(); //anim.Play( new int[4] { 4, 3, 2, 3 } ); anim.Play( new int[2] { 4, 3 } ); }
private void OnGUI() { ScriptableObject target = this; SerializedObject so = new SerializedObject(target); GUI.skin.label.richText = true; GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); EditorGUILayout.LabelField("Generate Animation Texture"); GameObject prefab = EditorGUILayout.ObjectField("Asset to Evaluate", _animatorObject, typeof(GameObject), true) as GameObject; if (prefab != _animatorObject) { _animatorObject = prefab; _skinnedMeshes = prefab != null?prefab.GetComponentsInChildren <SkinnedMeshRenderer>() : new SkinnedMeshRenderer[0]; _skinnedMeshIndex = 0; } if (_animatorObject != null && _skinnedMeshes != null && _skinnedMeshes.Length > 0) { string[] skinnedMeshes = new string[_skinnedMeshes.Length]; for (int i = 0; i < skinnedMeshes.Length; i++) { skinnedMeshes[i] = _skinnedMeshes[i].gameObject.name; } _skinnedMeshIndex = EditorGUILayout.Popup("Skinned Mesh", _skinnedMeshIndex, skinnedMeshes); } _fps = EditorGUILayout.IntField("FPS", _fps); _fps = Mathf.Clamp(_fps, 1, 120); //Draw list showing animation clip, SerializedProperty animationsProperty = so.FindProperty("_animations"); EditorGUILayout.PropertyField(animationsProperty, true); so.ApplyModifiedProperties(); if (_skinnedMeshes != null && _animations != null && _animations.Length > 0) { if (GUILayout.Button("Generate")) { string path = EditorUtility.SaveFilePanelInProject("Save Animation Texture", Path.GetFileNameWithoutExtension(_currentFileName), "bytes", "Please enter a file name to save the animation texture to"); if (!string.IsNullOrEmpty(path)) { _currentFileName = path; GameObject sampleObject = Instantiate(_animatorObject); SkinnedMeshRenderer[] skinnedMeshes = sampleObject.GetComponentsInChildren <SkinnedMeshRenderer>(); SkinnedMeshRenderer skinnedMesh = skinnedMeshes[_skinnedMeshIndex]; Transform[] bones = skinnedMesh.bones; Matrix4x4[] bindPoses = skinnedMesh.sharedMesh.bindposes; AnimationTexture animationTexture = CreateAnimationTexture(sampleObject, bones, bindPoses, _animations, _fps); SaveAnimationTexture(animationTexture, _currentFileName); DestroyImmediate(sampleObject); } } } }
/// <summary> /// Load graphics content for the game. /// </summary> public override void LoadContent() { baseRes = new Vector2(1280 * 1.2f, 720 * 1.2f); resolution = new Vector2(ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight); curCameraOffset = Vector2.Zero; if (content == null) { content = new ContentManager(ScreenManager.Game.Services, "Content"); util = new Utility(content); } bgImage = content.Load <Texture2D>("backgroundTest"); backgroundTiles = new Texture2D[70, 5]; for (int i = 1; i < 71; i++) { backgroundTiles[i - 1, 0] = content.Load <Texture2D>(@"Background/BG/background_" + (i).ToString("00")); backgroundTiles[i - 1, 1] = content.Load <Texture2D>(@"Background/BG/background_" + (i + 70).ToString("00")); backgroundTiles[i - 1, 2] = content.Load <Texture2D>(@"Background/BG/background_" + (i + 140).ToString("00")); backgroundTiles[i - 1, 3] = content.Load <Texture2D>(@"Background/BG/background_" + (i + 210).ToString("00")); backgroundTiles[i - 1, 4] = content.Load <Texture2D>(@"Background/BG/background_" + (i + 280).ToString("00")); } levelSolidBBs = new System.Collections.Generic.List <Rectangle>(40); levelSolidBBs.Add(new Rectangle(0, 660, 5600, 10)); levelSolidBBs.Add(new Rectangle(0, -34, 122, 754)); levelSolidBBs.Add(new Rectangle(4230, 445, 230, 50)); levelSolidBBs.Add(new Rectangle(4520, 440, 500, 400)); //levelSolidBBs.Add(new Rectangle(5230, -110, 256, 830)); levelSolidBBs.Add(new Rectangle(5070, 282, 126, 438)); //levelSolidBBs.Add(new Rectangle(5620, -88, 774, 808)); //levelSolidBBs.Add(new Rectangle( 6550, -276, 358, 996 )); //levelSolidBBs.Add(new Rectangle(7355, -460, 484, 1182)); //levelSolidBBs.Add(new Rectangle(7980 ,-542, 245, 1260)); //levelSolidBBs.Add(new Rectangle(8660, 138, 1474, 582)); //levelSolidBBs.Add(new Rectangle(10538, 88, 600, 632)); levelSolidBBs.Add(new Rectangle(11076, 626, 7494, 220)); levelSolidBBs.Add(new Rectangle(12240, 426, 356, 294)); //levelSolidBBs.Add(new Rectangle(12620,258,682,462)); levelSolidBBs.Add(new Rectangle(13300, 564, 5260, 156)); levelSolidBBs.Add(new Rectangle(19222, 552, 4932, 20)); levelSolidBBs.Add(new Rectangle(22265, 398, 76, 322)); //levelSolidBBs.Add(new Rectangle(22404, 320, 21, 400)); levelSolidBBs.Add(new Rectangle(22692, 208, 84, 542)); levelSolidBBs.Add(new Rectangle(24166, -326, 792, 1046)); levelTopBBs = new System.Collections.Generic.List <Rectangle>(40); levelTopBBs.Add(new Rectangle(1620, 542, 140, 180)); levelTopBBs.Add(new Rectangle(1880, -22, 660, 50)); levelTopBBs.Add(new Rectangle(3964, 480, 192, 50)); levelTopBBs.Add(new Rectangle(4320, 360, 130, 50)); levelTopBBs.Add(new Rectangle(4500, 286, 500, 200)); levelTopBBs.Add(new Rectangle(5070, 64, 120, 20)); levelTopBBs.Add(new Rectangle(8395, -560, 20, 154)); levelTopBBs.Add(new Rectangle(8520, -330, 20, 154)); levelTopBBs.Add(new Rectangle(18552, 368, 224, 352)); levelTopBBs.Add(new Rectangle(233701, 406, 164, 314)); levelTopBBs.Add(new Rectangle(5620, -88, 774, 808)); levelTopBBs.Add(new Rectangle(6550, -276, 358, 996)); levelTopBBs.Add(new Rectangle(7355, -460, 484, 1182)); levelTopBBs.Add(new Rectangle(7980, -542, 245, 1260)); levelTopBBs.Add(new Rectangle(8660, 138, 1474, 582)); levelTopBBs.Add(new Rectangle(10360, 88, 600, 632)); levelTopBBs.Add(new Rectangle(12620, 258, 682, 462)); levelTopBBs.Add(new Rectangle(22404, 320, 201, 400)); levelTopBBs.Add(new Rectangle(5230, -110, 256, 830)); levelTopBBs.Add(new Rectangle(22692, 178, 84, 542)); levelTopBBs.Add(new Rectangle(18802, 434, 286, 428)); projectileTex = content.Load <Texture2D>("testProj"); briefCaseSS = new AnimatedSpriteSheet(TimeSpan.Zero, true, content.Load <Texture2D>("briefcase"), new Vector2(48f, 48f), 1); healthTex = content.Load <Texture2D>("hat"); hatSS = new AnimatedSpriteSheet(TimeSpan.Zero, true, healthTex, new Vector2(48f, 48f), 1); gameFont = content.Load <SpriteFont>("gamefont"); diagFont = content.Load <SpriteFont>("diagFont"); border = content.Load <Texture2D>(@"Background/border"); testAnimTex = new AnimationTexture(TimeSpan.Zero, true); testProjectile = new AnimatedSpriteSheet(TimeSpan.Zero, true, projectileTex, new Vector2(projectileTex.Width, projectileTex.Height), 1); projectileSS = new AnimatedSpriteSheet[8]; for (int i = 1; i < 9; i++) { projectileSS[i - 1] = new AnimatedSpriteSheet(TimeSpan.Zero, true, content.Load <Texture2D>(@"Projectiles/item" + i), new Vector2(64f, 64f), 1); } for (int i = 1; i < 10; i++) { testAnimTex.AddFrame(content.Load <Texture2D>(@"testAnim1\tempAnim000" + i)); } for (int i = 10; i < 28; i++) { testAnimTex.AddFrame(content.Load <Texture2D>(@"testAnim1\tempAnim00" + i)); } for (int i = 0; i < projectiles.Length; i++) { projectiles[i] = new Projectile(); } /*xml parsing test * String xmlfile; * firstXmlContent = Content.Load<string>(@"xmlfile"); * int[] enemy = new int[3]; * int[] Object = new int[4]; */ testAnimTex.ResetTimer(TimeSpan.Zero); testAnimTex.ReStartAnimation(TimeSpan.Zero); testAnimTex.SetFrameRate(30.0); testSS = new AnimatedSpriteSheet(TimeSpan.Zero, true, content.Load <Texture2D>(@"testAnim1\tempAnimSS"), new Vector2(256.0f, 192.0f), 27); testSS.ResetTimer(TimeSpan.Zero); testSS.ReStartAnimation(TimeSpan.Zero); testSS.SetFrameRate(45.0); this.ScreenManager.Game.ResetElapsedTime(); charControllers.Add(new PlayerController(new Character(new Vector2(100F, 200F), 10F, 10, 10, content, 1.0f, "Player\\player", 100), PlayerInput.get(0))); charControllers.Add(new AIController(new Character(new Vector2(600F, 200F), 10F, 10, 10, content, 1.0f, "Enemy\\ninja", 100), this)); /* * testHUD = new HUD(this.ScreenManager); * testHUD.AddHudItem(healthTex, HudItemPos.topLeft, Vector2.Zero, 0.10f, "life", 3); * testHUD.AddHudItem(healthTex, HudItemPos.topRight, Vector2.Zero, 0.10f, "lives", 4, diagFont); * testHUD.AddHudItem(healthTex, HudItemPos.bottomLeft, Vector2.Zero, 0.10f, "cases", 2, diagFont); * testHUD.AddHudItem(healthTex, HudItemPos.bottomRight, Vector2.Zero, 0.10f, "ammo", 80, diagFont); */ resolutionScaler = Matrix.CreateScale(resolution.X / baseRes.X, resolution.Y / baseRes.Y, 1f); }