public void GetNextSelector() { int indexOfNext = ObjectsSelector.IndexOfKey(CircularSelector.SelectableObjects) + 1; indexOfNext %= ObjectsSelector.Count; CircularSelector = ObjectsSelector.Values[indexOfNext]; }
public void GetPrevSelector() { int indexOfPrev = ObjectsSelector.IndexOfKey(CircularSelector.SelectableObjects) - 1; if (indexOfPrev < 0) { indexOfPrev += ObjectsSelector.Count; } CircularSelector = ObjectsSelector.Values[indexOfPrev]; }
public RepresentedVelocityTracker(ValkyrieSprite host) : base(host) { FrameHistories = new CircularSelector <FrameHistory>(FrameHistoryLength); for (int i = 0; i < FrameHistoryLength; i++) { FrameHistory history = new FrameHistory(); history.Reset(Vector3.zero); FrameHistories.Add(history); } }
public EditorManager( ContentManager content, GraphicsDevice graphicsDevice, GraphicsDeviceManager graphics) { _content = content; _graphicsDevice = graphicsDevice; _graphics = graphics; _mapLoader = new MapLoader(content); CursorPosition = Vector2.Zero; CursorSize = new Vector2(10); InitialRectangle = new Rectangle(0, 0, 2000, 2000); GameObjectTextures = new Dictionary <string, Dictionary <string, Texture2D> >(); ObjectsSelector = new SortedList <string, CircularSelector>(); LoadMiscTextures(); LoadAllGameObjects(); CircularSelector = ObjectsSelector.First().Value; }
protected override void OnEnemyInit() { _DamageTextAngleStep *= Mathf.Deg2Rad; _InfernoDamageTextAngle *= Mathf.Deg2Rad; AngleLanes = new CircularSelector <Vector3>(); for (float f = 0; f < MathUtil.Pi2f - 0.01f; f += DamageTextAngleStep) { AngleLanes.Add(MathUtil.VectorAtRadianAngle(f, DamageTextDistance)); } InfernoDamageAngle = MathUtil.VectorAtRadianAngle(InfernoDamageTextAngle, InfernoDamageTextDistance); ParticleColor = Color.green; ParticleColorAlt = new Color32(255, 182, 193, 255); base.OnActivate(); LastestDamageHealthBar.Init(); }
public void LoadAllGameObjects() { List <String> DirNames = new List <String> { "Interactables", "Grounds", "Rocks" }; GameObjectFactory factory = new GameObjectFactory(); foreach (String dirName in DirNames) { Dictionary <string, Texture2D> objectTextures = TextureContent.LoadListContent <Texture2D>(_content, dirName); List <GameObject> ObjectTemplates = new List <GameObject>(); GameObjectTextures.Add(dirName, objectTextures); foreach (var gameObj in objectTextures) { // the type of the object to create is extracted from the // sprite name string objType = gameObj.Key.Split('/').Last(); // for more objects of the same type, the delimitor used is underscore objType = objType.Split('_').First().ToLower(); Obj gobj = new Obj { Type = objType, Position = Vector2.Zero, SpriteSize = new Vector2(150, 100) }; // don't add the key to the placeable gameObjects if (objType == "key") { continue; } GameObject gameObject = factory.Create(gobj); if (objType == "door") { (gameObject as Door).LockedLight.Texture = GameObjectTextures["Misc"]["red_light"]; (gameObject as Door).UnlockedLight.Texture = GameObjectTextures["Misc"]["green_light"]; } if (objType == "rockandhook") { (gameObject as RockHook).Rope.Texture = GameObjectTextures["Misc"]["Rope"]; (gameObject as RockHook).Rope.SecondTexture = GameObjectTextures["Misc"]["Rope_transparent"]; } if (objType == "platform") { (gameObject as Platform).Background.Texture = GameObjectTextures["Misc"]["platform_mechanismy"]; } if (objType == "plankx") { continue; } if (objType == "planka") { continue; } if (objType == "plankbrope") { continue; } if (objType == "plankxrope") { continue; } if (objType == "plankpickaxe") { continue; } if (objType == "plankrb") { continue; } if (objType == "plankrt") { continue; } if (objType == "plankxrope") { continue; } if (objType == "plankkey") { continue; } gameObject.Texture = gameObj.Value; //TODO: remove this ugly hardcoding if (objType != "lever" && objType != "button") { ObjectTemplates.Add(gameObject); } } CircularSelector circSelector = new CircularSelector(_content, dirName); circSelector.SetObjects(ObjectTemplates); ObjectsSelector.Add(dirName, circSelector); } }