예제 #1
0
    private void AddDoor(Vector3 location)
    {
        int id = Game.EntityManager.CreateEntity();

        var formComp = new FormComponent();

        formComp.InitComponent(id, location, "Door001", "");
        Game.EntityManager.AddComponent(id, formComp);

        var openComp = new OpenComponent();

        openComp.InitComponent(null);
        Game.EntityManager.AddComponent(id, openComp);

        var animComp = new AnimationComponent();

        animComp.InitComponent(null);
        animComp.Animations.Add(new AnimationSystem.AnimationData()
        {
            EntityID = id, Name = "DoorClose90", Sound = "DoorClose001", DisablePhysics = true, TriggerEvent = RPGGameEvent.Menu_Close
        });
        animComp.Animations.Add(new AnimationSystem.AnimationData()
        {
            EntityID = id, Name = "DoorOpen90", Sound = "DoorOpen001", DisablePhysics = true, TriggerEvent = RPGGameEvent.Menu_Open
        });
        Game.EntityManager.AddComponent(id, animComp);

        //// Theoretically, this should work if the attribute table is set in the blueprints. Untested
        //var cursorComp = new CursorComponent();
        //cursorComp.InitComponent(null);
        //Game.EntityManager.AddComponent(id, cursorComp);
    }
예제 #2
0
    private void AddChest(Vector3 location, bool locked, bool trapped, bool addHealth)
    {
        int id = Game.EntityManager.CreateEntity();

        var formComp = new FormComponent();

        formComp.InitComponent(id, location, "Chest001", "Chest001_Broken");
        Game.EntityManager.AddComponent(id, formComp);

        var openComp = new OpenComponent();

        openComp.InitComponent(null);
        Game.EntityManager.AddComponent(id, openComp);

        var animComp = new AnimationComponent();

        animComp.InitComponent(null);
        animComp.Animations.Add(new AnimationSystem.AnimationData()
        {
            EntityID = id, Name = "ChestClose", Sound = "ChestClose001", DisablePhysics = true, TriggerEvent = RPGGameEvent.Menu_Close
        });
        animComp.Animations.Add(new AnimationSystem.AnimationData()
        {
            EntityID = id, Name = "ChestOpen90", Sound = "ChestOpen001", DisablePhysics = true, TriggerEvent = RPGGameEvent.Menu_Open
        });
        Game.EntityManager.AddComponent(id, animComp);

        if (locked)
        {
            var lockComp = new LockComponent();
            lockComp.InitComponent(null);
            lockComp.InitComponent(44);
            Game.EntityManager.AddComponent(id, lockComp);
        }

        if (trapped)
        {
            var trapComp = new TrapComponent();
            trapComp.InitComponent(formComp, new EffectSystem.EffectData()
            {
                AreaOfEffectRadius = 10,
                Duration           = 5,
                PrefabName         = "AOE/Fireball",
                TargetType         = EffectSystem.TargetTypeEnum.AreaOfEffect,
                Damage             = new DieRollData(2, 4, 0, 0),
                DamageType         = AttackSystem.DamageTypes.Crush,
                Description_Attack = "Fireball Blast"
            });
            Game.EntityManager.AddComponent(id, trapComp);
        }

        if (addHealth)
        {
            var health = new HealthComponent()
            {
                Damage = 0, DeathType = HealthComponent.DeathTypes.Broken, HP_Max = 5000
            };
            Game.EntityManager.AddComponent(id, health);
        }
    }