Exemple #1
0
    public override void Execute(BattleObject actor, GameAction action)
    {
        string name = "";
        Dictionary <string, string> hbox_dict = new Dictionary <string, string>();

        foreach (SubactionVarData data in arg_dict.Values)
        {
            if (data.name == "hitboxName")
            {
                name = (string)data.GetData(actor, action);
            }
            else
            {
                hbox_dict.Add(data.name, data.GetData(actor, action).ToString());
            }
        }
        if (action.hitboxes.ContainsKey(name))
        {
            Debug.LogWarning(string.Format("Creating a hitbox named {0} while one already exists. This hitbox will be overwritten with the new data.", name));
        }
        Hitbox hbox = HitboxLoader.CreateHitbox(actor.gameObject, hbox_dict);

        //Hitbox hbox = HitboxLoader.loader.LoadHitbox(actor.GetAbstractFighter(), action, hbox_dict);
        action.hitboxes.Add(name, hbox);
    }
Exemple #2
0
        protected override void LoadContent()
        {
            base.LoadContent();


            ComponentFactory factory = new ComponentFactory(Content);

            graphics.PreferredBackBufferWidth  = 1920; // set this value to the desired width of your window
            graphics.PreferredBackBufferHeight = 1080; // set this value to the desired height of your window
            graphics.ApplyChanges();

            TextureRegion orangeRegion = new TextureRegion(Content.Load <Texture2D>("Test/orangeSquare"), 0, 0, 32, 32);

            HitboxLoader hitboxLoader = new HitboxLoader(stage);
            BoxSpawn     boxSpawn     = new BoxSpawn(factory.playerWalk[0], stage);

            playerSpawns = new PlayerSpawnLocations();
            //GunSpawn gunSpawn = new GunSpawn(factory.gunRegions, stage);

            Physic.Instance.collisionRules.Add(new MultiKey <int>(1, 2), false);

            Actor     baseActor = stage.CreateActor(0);
            TiledBase tiledBase = baseActor.AddComponent <TiledBase>();

            tiledBase.Set(Content);
            tiledBase.OnCollisionHitboxLoaded += hitboxLoader.OnCollisionHitboxLoaded;
            tiledBase.OnObjectLoaded          += boxSpawn.OnObjectLoaded;
            tiledBase.OnObjectLoaded          += playerSpawns.OnObjectLoaded;
            //tiledBase.OnObjectLoaded += gunSpawn.OnObjectLoaded;

            TiledMapComponent[] components = tiledBase.AddMap(stage, "maps/level1", true, true);
        }
 private void Start()
 {
     loader = this;
 }