Exemplo n.º 1
0
    private void OnAnimationEnd(ref AnimationInfo info)
    {
        //Look if end of state Dying
        if (info.NewState != State.Dying)
        {
            return;
        }

        if (info.Entity == GameVariables.Player.Entity)
        {
            //GlobalEvents.PlayerEvents.OnPlayerDie();
            return;
        }

        if (rnd.Next(20) == 10)
        {
            if (entityManager.HasComponent <Translation>(info.Entity))
            {
                var trans = entityManager.GetComponentData <Translation>(info.Entity);

                //Player only has a pistol
                if (GameVariables.Player.PlayerCurrentWeapons.Count <= 1)
                {
                    return;
                }

                int        index      = rnd.Next(1, GameVariables.Player.PlayerCurrentWeapons.Count);
                WeaponType weaponType = GameVariables.Player.PlayerCurrentWeapons[index];
                DropSystem.DropAmmunition(entityManager, trans.Value, weaponType);
            }
        }

        //Destroy entity
        entityManager.DestroyEntity(info.Entity);
    }
Exemplo n.º 2
0
        public ShopState(EntityMaintenanceSystem eMS, GearSystem gSys, StatModifierSystem sMSys, StatsSystem sSys, ExperienceSystem eSys, PlayerSystem pSys, DropSystem dSys, NameSystem nSys, StateMachine sMach, ItemSystem iSys, GameMap gMap)
        {
            entMaintenanceSystem = eMS;
            gearSystem = gSys;
            modifierSystem = sMSys;
            statsSystem = sSys;
            experienceSystem = eSys;
            playerSystem = pSys;
            dropSystem=dSys;
            nameSystem = nSys;
            itemSystem = iSys;

            stateSystem = sMach;

            gameMap = gMap;
            NumItems = 5;
        }
Exemplo n.º 3
0
        public CombatSystem(Lua Lua, ActionSystem actSys, ActionInventorySystem actInvSys, AISystem aiSys, DropSystem dSys, EffectSystem eSys, EntityMaintenanceSystem eMainSys, ExperienceSystem xSys, ItemInventorySystem iSys, NameSystem nSys, PlayerSystem pSys, StatsSystem sSys)
        {
            actionSystem = actSys;
            aInventorySystem = actInvSys;
            aiSystem = aiSys;
            dropSystem = dSys;
            effectSystem = eSys;
            entityMaintenanceSystem = eMainSys;
            experienceSystem = xSys;
            inventorySystem = iSys;
            nameSystem = nSys;
            playerSystem = pSys;
            statsSystem = sSys;

            lua = Lua;
            RegisterLuaFunctions();
        }
Exemplo n.º 4
0
    void Start()
    {
        currentHealth = maxHealth;
        if (statusIndicator != null)
        {
            statusIndicator.SetHealth(currentHealth, maxHealth);
        }
        nextAttackTime = Time.time + Random.Range(10f / attackRate, 25f / attackRate);
        enemyRigidBody = GetComponent <Rigidbody2D>();
        attackDistance = Vector2.Distance(transform.position, attackPoint.transform.position)
                         + attackRange;
        flipDirection    = 0;
        jumpDirection    = -1;
        WalkingDirection = new Vector3(0, enemyRigidBody.velocity.y);
        basicRecoilForce = recoilForce;

        camShake     = Game.game.GetComponent <CameraShake>();
        damageSystem = GetComponent <DamageSystem>();
        dropSystem   = GetComponent <DropSystem>();
    }
Exemplo n.º 5
0
 public EntityManager(StateMachine sMach, DropSystem dSys, PlayerSystem pS, StatsSystem sS, ItemSystem iS, StatModifierSystem mS, EffectSystem efS, EquipmentSystem eqS, AISystem aiS, GearSystem gS, ExperienceSystem xS, ItemInventorySystem invS, NameSystem nS, ProfessionSystem profS, ActionSystem actS, ActionInventorySystem aInvS, CombatSystem cSys, EntityMaintenanceSystem eMS)
 {
     stateSystem = sMach;
     dropSystem = dSys;
     entMaintenanceSystem = eMS;
     aInventorySystem = aInvS;
     combatSystem = cSys;
     playerSystem = pS;
     statsSystem = sS;
     itemSystem = iS;
     modifierSystem = mS;
     effectSystem = efS;
     equipmentSystem = eqS;
     aiSystem = aiS;
     gearSystem = gS;
     experienceSystem = xS;
     inventorySystem = invS;
     nameSystem = nS;
     professionSystem = profS;
     actionSystem = actS;
 }
Exemplo n.º 6
0
    protected override void OnCreate()
    {
        var world = World.DefaultGameObjectInjectionWorld;

        stateEventSystem     = world.GetOrCreateSystem <StateEventSystem>();
        animationEventSystem = world.GetOrCreateSystem <AnimationEventSystem>();

        interactableEventSystem = world.GetOrCreateSystem <InteractableEventSystem>();

        soundEventSystem          = world.GetOrCreateSystem <SoundEventSystem>();
        lootSystem                = world.GetOrCreateSystem <LootSystem>();
        visualEventSystem         = world.GetOrCreateSystem <VisualEventSystem>();
        cleanupSystem             = world.GetOrCreateSystem <CleanupSystem>();
        dropSystem                = world.GetOrCreateSystem <DropSystem>();
        uiSystem                  = world.GetOrCreateSystem <UISystem>();
        globalEventListenerSystem = world.GetOrCreateSystem <GlobalEventListenerSystem>();
        playerCollisionSystem     = world.GetOrCreateSystem <PlayerCollisionSystem>();
        invincibleSystem          = world.GetOrCreateSystem <InvincibleSystem>();
        interactableDoorSystem    = world.GetOrCreateSystem <InteractableDoorSystem>();

        var presentation = world.GetOrCreateSystem <PresentationManager>();

        presentation.AddSystemToUpdateList(stateEventSystem);
        presentation.AddSystemToUpdateList(animationEventSystem);
        presentation.AddSystemToUpdateList(interactableEventSystem);
        presentation.AddSystemToUpdateList(lootSystem);
        presentation.AddSystemToUpdateList(visualEventSystem);
        presentation.AddSystemToUpdateList(soundEventSystem);
        presentation.AddSystemToUpdateList(cleanupSystem);
        presentation.AddSystemToUpdateList(dropSystem);
        presentation.AddSystemToUpdateList(uiSystem);
        presentation.AddSystemToUpdateList(globalEventListenerSystem);
        presentation.AddSystemToUpdateList(invincibleSystem);
        presentation.AddSystemToUpdateList(interactableDoorSystem);
        // presentation.AddSystemToUpdateList(playerCollisionSystem);

        presentation.SortSystemUpdateList();
    }
Exemplo n.º 7
0
 void Awake()
 {
     instance = this;
 }
Exemplo n.º 8
0
 private void Start()
 {
     manager       = GameObject.FindWithTag("GameManager");
     _initQuestion = GetComponent <InitQuestion>();
     _dropSystem   = manager.GetComponent <DropSystem>();
 }
Exemplo n.º 9
0
        private void InitializeSystems()
        {
            Console.WriteLine("Initializing Game Systems");

            professionSystem = new ProfessionSystem();
            effectSystem=new EffectSystem(lua);
            equipmentSystem = new EquipmentSystem();
            experienceSystem = new ExperienceSystem();         
            itemSystem = new ItemSystem();
            inventorySystem = new ItemInventorySystem();
            modifierSystem = new StatModifierSystem();
            nameSystem = new NameSystem(lua);
            playerSystem = new PlayerSystem(nameSystem, stateSystem);
            gearSystem = new GearSystem();
            statsSystem = new StatsSystem();
            aInventorySystem = new ActionInventorySystem(lua, statsSystem);
            actionSystem = new ActionSystem(lua);
            aiSystem = new AISystem();
            dropSystem = new DropSystem(dropMap);
        }