Esempio n. 1
0
 public StashViewController(IStashView view, Stash stash, CharacterManager characterManager) : base(view)
 {
     this.stash     = stash;
     this.character = characterManager.Character;
     this.inventory = characterManager.Character.Entity.GetComponent <InventoryComponent>();
     this.equipment = characterManager.Character.Entity.GetComponent <EquipmentComponent>();
 }
    public void SetupActiveAbility(ActiveAbility active, EquipmentComponent equipmentComponent)
    {
        switch (equipmentComponent)
        {
        case EquipmentComponent.Head:
            _playerMain._headActiveAbility = active;
            break;

        case EquipmentComponent.Torso:
            _playerMain._torsoActiveAbility = active;
            break;

        case EquipmentComponent.RightArm:
            _playerMain._rightArmActiveAbility = active;
            break;

        case EquipmentComponent.LeftArm:
            _playerMain._leftArmActiveAbility = active;
            break;

        case EquipmentComponent.Legs:
            _playerMain._legsActiveAbility = active;
            break;
        }

        OverrideActiveAbilityAnimations(
            active == null ? _playerMain._initial_activeAbilityAnimations : active._abilityAnimations,
            equipmentComponent);
    }
 public override void Init(Entity entity, GameObject entityGO)
 {
     items             = new ItemComponent[maxSpaces];
     positionComponent = (PositionComponent)entity.GetEntityComponent(ComponentID.Position);
     equipment         = (EquipmentComponent)entity.GetEntityComponent(ComponentID.Equipment);
     thisEntity        = entity;
 }
    public void OverrideEquipmentAnimations(AnimationClip[] overridedAnimations, EquipmentComponent equipmentComponent)
    {
        if (overridedAnimations.Length == 0)
        {
            return;
        }

        //RuntimeAnimatorController runtime = _initialRuntimeAnimatorController;
        //AnimatorOverrideController over = new AnimatorOverrideController();
        //_overrideController.runtimeAnimatorController = runtime;

        string animName = string.Empty;

        switch (equipmentComponent)
        {
        case EquipmentComponent.LeftArm:
            animName = "PlayerLeftArm0";
            break;

        case EquipmentComponent.RightArm:
            animName = "PlayerRightArm0";
            break;
        }

        for (int i = 0; i < overridedAnimations.Length; i++)
        {
            _overrideController[animName + (i + 1)] = overridedAnimations[i];
        }

        _animator.runtimeAnimatorController = _overrideController;
    }
Esempio n. 5
0
 private void LoadDependencies()
 {
     this.AC  = Player.Character.GetComponent <AttributesComponent>();
     this.EC  = Player.Character.GetComponent <EquipmentComponent>();
     this.PCC = Player.Character.GetComponent <PlayerControlComponent>();
     this.SC  = Player.Character.GetComponent <ScoreComponent>();
 }
Esempio n. 6
0
        public void Construct(Character character)
        {
            this.character = character;
            this.inventory = character.Entity.GetComponent <InventoryComponent>();
            this.equipment = character.Entity.GetComponent <EquipmentComponent>();

            this.vendorPanel.Construct();
        }
Esempio n. 7
0
 public DismantlingViewController(IDismantlingView view, IItemRepository itemRepository,
                                  CharacterManager characterManager) : base(view)
 {
     this.itemRepository = itemRepository;
     this.character      = characterManager.Character;
     this.inventory      = characterManager.Character.Entity.GetComponent <InventoryComponent>();
     this.equipment      = characterManager.Character.Entity.GetComponent <EquipmentComponent>();
 }
Esempio n. 8
0
        public void Construct(Character character, Currency price)
        {
            this.character = character;
            this.inventory = character.Entity.GetComponent <InventoryComponent>();
            this.equipment = character.Entity.GetComponent <EquipmentComponent>();

            this.priceIcon.sprite = Resources.Load <Sprite>(price.Icon);
            this.priceText.text   = price.Amount.ToString();
        }
Esempio n. 9
0
        public override void Prepare(Item item, EquipmentSlot slot, EquipmentComponent equipment)
        {
            base.Prepare(item, slot, equipment);

            foreach (var s in equipment.Slots.Where(s => s.Item.IsTwoHandedWeapon))
            {
                equipment.Unequip(s.Item);
            }
        }
Esempio n. 10
0
    void Awake()
    {
        _equipment = GetComponent<EquipmentComponent>();
        _movement = GetComponent<MovementComponent>();
        _health = GetComponent<HealthComponent>();
        _skelAnim = GetComponent<SkeletonAnimation>();

        _health.armorValue = _equipment.GetArmor();
    }
Esempio n. 11
0
        public void RemoveEquipmentComponent(EquipmentComponent model)
        {
            var ec = _context.EquipmentComponents.FirstOrDefault(c => c.ComponentName == model.ComponentName);

            if (ec != null)
            {
                _context.EquipmentComponents.Remove(ec);
            }
        }
Esempio n. 12
0
        public VendorViewController(IVendorView view, IItemRepository itemRepository,
                                    CharacterManager characterManager) : base(view)
        {
            this.itemRepository = itemRepository;

            this.character  = characterManager.Character;
            this.inventory  = characterManager.Character.Entity.GetComponent <InventoryComponent>();
            this.equipment  = characterManager.Character.Entity.GetComponent <EquipmentComponent>();
            this.currencies = characterManager.Character.Entity.GetComponent <CurrenciesComponent>();
            this.assortment = RandomizeVendorAssortment();
        }
Esempio n. 13
0
        /// <summary>
        /// Creates this system.
        /// </summary>
        /// <param name="game"></param>
        public WeaponSystem(DungeonCrawlerGame game)
        {
            _game = game;

            //To simplfy some things, I'm keeping a reference to components I often use.
            _collisionComponent = _game.CollisionComponent;
            _equipmentComponent = _game.EquipmentComponent;
            _playerInfoComponent = _game.PlayerInfoComponent;
            _weaponComponent = _game.WeaponComponent;
            _weaponSpriteComponent = _game.WeaponSpriteComponent;
            _positionComponent = _game.PositionComponent;
        }
Esempio n. 14
0
        public InventoryWindow(InventoryWindowTemplate template)
            : base(null, template)
        {
            Contract.Requires <ArgumentNullException>(template != null, "template");
            Contract.Requires <ArgumentNullException>(template.Items != null, "template.Items");
            Contract.Requires <ArgumentNullException>(template.World != null, "player");

            _inventory = template.World.Player.Get <ItemContainerComponent>();
            _equipment = template.World.Player.Get <EquipmentComponent>();
            _player    = template.World.Player;

            _bodyPartWidth = _equipment.Slots.Max(s => s.Length) + 5;              // todo replace to code
            _sizeList      = new Rectangle(new Point(1, 1), new Size(Size.Width - 2, Size.Height));
        }
Esempio n. 15
0
        private void Start()
        {
            this.equipment = GetComponentInParent <EquipmentComponent>();

            if (this.equipment == null)
            {
                return;
            }

            this.equipment.ItemEquipped   += OnItemEquipped;
            this.equipment.ItemUnequipped += OnItemUnequipped;
            this.equipment.Terminated     += OnTerminated;

            UpdateFlags();
        }
Esempio n. 16
0
        public WindowInventory(int x, int y, int w, int h, string title, EBorderStyle borderStyle, Entity player, HUD parent)
            : base(x, y, w, h, title, borderStyle, player, parent)
        {
            itemInfoWindow = new WindowItemInfo(0, 0, 30, 12, "[details]", EBorderStyle.ALL, player, parent);
            parent.windows.Add(itemInfoWindow);

            // cache the players inventory: NOTE: this needs to be updated if teh player is destroyed so that the component can be GC'd
            inventory = player.Get <InvComponent>();
            equipment = player.Get <EquipmentComponent>();

            equipSection.starty = 4;
            equipSection.endy   = 24;
            invSection.starty   = 25;
            invSection.endy     = h;
        }
Esempio n. 17
0
        public virtual void Prepare(Item item, EquipmentSlot slot, EquipmentComponent equipment)
        {
            if (!item.IsUniqueEquipped)
            {
                return;
            }

            var sameEquippedItem = equipment.Slots.FirstOrDefault(s => s.Item.Id == item.Id)?.Item;

            if (sameEquippedItem == null)
            {
                return;
            }

            equipment.Unequip(sameEquippedItem);
        }
Esempio n. 18
0
    public override void Init(Entity entity, GameObject entityGO)
    {
        thisEntity = entity;
        EntityComponent comp = entity.GetEntityComponent(ComponentID.Equipment);

        if (comp != null)
        {
            equipment = (EquipmentComponent)comp;
        }

        if (thisEntity.isPlayer == true)
        {
            OnHPChanged += UI_Manager.instance.HandlePlayerHealthUI;
            UI_Manager.instance.HandlePlayerHealthUI(curHP, maxHP);
        }
        else
        {
            OnHPChanged += UI_Manager.instance.HandleEnemyHealthUI;
            UI_Manager.instance.HandleEnemyHealthUI(curHP, maxHP);
        }
    }
    public void OverrideActiveAbilityAnimations(AnimationClip overridedAnimation, EquipmentComponent equipmentComponent)
    {
        if (overridedAnimation == null)
        {
            return;
        }
        //RuntimeAnimatorController runtime = _initialRuntimeAnimatorController;
        //AnimatorOverrideController over = new AnimatorOverrideController();
        //_overrideController.runtimeAnimatorController = runtime;

        string animName = string.Empty;

        switch (equipmentComponent)
        {
        case EquipmentComponent.Head:
            animName = "HeadActiveAbility";
            break;

        case EquipmentComponent.Torso:
            animName = "TorsoActiveAbility";
            break;

        case EquipmentComponent.RightArm:
            animName = "RightArmActiveAbility";
            break;

        case EquipmentComponent.LeftArm:
            animName = "LeftArmActiveAbility";
            break;

        case EquipmentComponent.Legs:
            animName = "LegsActiveAbility";
            break;
        }

        _overrideController[animName] = overridedAnimation;

        _animator.runtimeAnimatorController = _overrideController;
    }
Esempio n. 20
0
        private void InstanceTreeList(BaseEquipment baseEquipment)
        {
            float buttonWidth = treeObjectWidth / 9;
            //Debug.Log(buttonWidth);
            float height = buttonWidth * 6;

            contentTreeObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, height);
            GameObject ga = Instantiate(instacneTreeObject) as GameObject;

            ga.transform.SetParent(contentTreeObject.transform);
            ga.GetComponent <Image>().sprite                = baseEquipment.equipmentIcor;
            ga.GetComponent <RectTransform>().sizeDelta     = new Vector2(-(treeObjectWidth - buttonWidth), buttonWidth);
            ga.GetComponent <RectTransform>().localPosition = new Vector3(treeObjectWidth / 2, -buttonWidth);
            if (baseEquipment.equipmentType == EqunipmentType.SMALL)
            {
                return;
            }
            EquipmentComponent comp = (EquipmentComponent)baseEquipment;

            if (comp.equipmentCompmenTList.Count > 0)
            {
            }
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);
            WeaponFactory = new WeaponFactory(this);
            DoorFactory = new DoorFactory(this);
            RoomFactory = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory = new WallFactory(this);
            EnemyFactory = new EnemyFactory(this);
            SkillEntityFactory = new SkillEntityFactory(this);
            NPCFactory = new NPCFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();
            InventoryComponent = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent = new EquipmentComponent();
            WeaponComponent = new WeaponComponent();
            BulletComponent = new BulletComponent();
            PlayerInfoComponent = new PlayerInfoComponent();
            WeaponSpriteComponent = new WeaponSpriteComponent();
            StatsComponent = new StatsComponent();
            EnemyAIComponent = new EnemyAIComponent();
            NpcAIComponent = new NpcAIComponent();

            CollectibleComponent = new CollectibleComponent();
            CollisionComponent = new CollisionComponent();
            TriggerComponent = new TriggerComponent();
            EnemyComponent = new EnemyComponent();
            NPCComponent = new NPCComponent();
            //QuestComponent = new QuestComponent();
            LevelManager = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();
            SoundComponent = new SoundComponent();
            ActorTextComponent = new ActorTextComponent();
            TurretComponent = new TurretComponent();
            TrapComponent = new TrapComponent();
            ExplodingDroidComponent = new ExplodingDroidComponent();
            HealingStationComponent = new HealingStationComponent();
            PortableShieldComponent = new PortableShieldComponent();
            PortableStoreComponent = new PortableStoreComponent();
            ActiveSkillComponent = new ActiveSkillComponent();
            PlayerSkillInfoComponent = new PlayerSkillInfoComponent();

            Quests = new List<Quest>();

            #region Initialize Effect Components
            AgroDropComponent = new AgroDropComponent();
            AgroGainComponent = new AgroGainComponent();
            BuffComponent = new BuffComponent();
            ChanceToSucceedComponent = new ChanceToSucceedComponent();
            ChangeVisibilityComponent = new ChangeVisibilityComponent();
            CoolDownComponent = new CoolDownComponent();
            DamageOverTimeComponent = new DamageOverTimeComponent();
            DirectDamageComponent = new DirectDamageComponent();
            DirectHealComponent = new DirectHealComponent();
            FearComponent = new FearComponent();
            HealOverTimeComponent = new HealOverTimeComponent();
            InstantEffectComponent = new InstantEffectComponent();
            KnockBackComponent = new KnockBackComponent();
            TargetedKnockBackComponent = new TargetedKnockBackComponent();
            ReduceAgroRangeComponent = new ReduceAgroRangeComponent();
            ResurrectComponent = new ResurrectComponent();
            StunComponent = new StunComponent();
            TimedEffectComponent = new TimedEffectComponent();
            EnslaveComponent = new EnslaveComponent();
            CloakComponent = new CloakComponent();
            #endregion

            base.Initialize();
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);
            WeaponFactory = new WeaponFactory(this);
            DoorFactory = new DoorFactory(this);
            RoomFactory = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory = new WallFactory(this);
            EnemyFactory = new EnemyFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();
            InventoryComponent = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent = new EquipmentComponent();
            WeaponComponent = new WeaponComponent();
            BulletComponent = new BulletComponent();
            PlayerInfoComponent = new PlayerInfoComponent();
            WeaponSpriteComponent = new WeaponSpriteComponent();
            StatsComponent = new StatsComponent();
            EnemyAIComponent = new EnemyAIComponent();
            CollectibleComponent = new CollectibleComponent();
            CollisionComponent = new CollisionComponent();
            TriggerComponent = new TriggerComponent();
            EnemyComponent = new EnemyComponent();
            QuestComponent = new QuestComponent();
            LevelManager = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();

            //TurretComponent = new TurretComponent();
            //TrapComponent = new TrapComponent();
            //PortableShopComponent = new PortableShopComponent();
            //PortableShieldComponent = new PortableShieldComponent();
            //MotivateComponent =  new MotivateComponent();
            //FallbackComponent = new FallbackComponent();
            //ChargeComponent = new ChargeComponent();
            //HealingStationComponent = new HealingStationComponent();
            //ExplodingDroidComponent = new ExplodingDroidComponent();

            base.Initialize();
        }