Exemplo n.º 1
0
    void Start()
    {
        eventManager = gameObject.AddComponent <EventManager>();
        EventManager.instance.RegisterListener <EndCollisionEvent>(this);


        entityManager = World.Active.EntityManager;
        spawner       = gameObject.AddComponent <Spawner>();


        //Debug.Log(cardLibrary[0].cardName + "," + cardLibrary[1].cardName + "," + cardLibrary[2].cardName + "," + cardLibrary[3].cardName);
        World.Active.GetExistingSystem <DrawSystem>().Enabled = true;
        World.Active.GetExistingSystem <CollisionDetectionSystem>().Enabled = true;
        World.Active.GetExistingSystem <ControlSystem>().Enabled            = true;
        World.Active.GetExistingSystem <DeletionSystem>().Enabled           = true;
        World.Active.GetExistingSystem <MovementSystem>().Enabled           = true;
        World.Active.GetExistingSystem <PlayerValueSystem>().Enabled        = true;
        World.Active.GetExistingSystem <QuadTreeSystem>().Enabled           = true;
        World.Active.GetExistingSystem <BuffSystem>().Enabled       = true;
        World.Active.GetExistingSystem <SpawnDelaySystem>().Enabled = true;
        World.Active.GetExistingSystem <RotationSystem>().Enabled   = true;
        World.Active.GetExistingSystem <GravitySystem>().Enabled    = true;

        World.Active.GetExistingSystem <QuadTreeDrawingSystem>().Enabled = true;
        //World.Active.GetExistingSystem<CollisionBoxDrawingSystem>().Enabled = true;
        //World.Active.GetExistingSystem<CollisionBoxDrawingSystem>().Enabled = true;
        //World.Active.GetExistingSystem<QuadTreeJobSystem>().Enabled = true;
        //World.Active.GetExistingSystem<QuadTreeJobDrawingSystem>().Enabled = true;

        cardLibrary = cl.GetAllByID();

        PlayerEntity.Create(entityManager, new Vector2(-boundaryOffset, 0), new Vector2(0, 0), playerRadius, 1, maxHealth, maxMana, manaRegen, mesh2D, playDeck1.GetPrimary(), playerMat);
        PlayerEntity.Create(entityManager, new Vector2(boundaryOffset, 0), new Vector2(0, 0), playerRadius, 2, maxHealth, maxMana, manaRegen, mesh2D, playDeck2.GetPrimary(), playerMat);

        EventManager.instance.QueueEvent(new UIUpdateEvent(maxHealth, (int)maxMana, 1));
        EventManager.instance.QueueEvent(new UIUpdateEvent(maxHealth, (int)maxMana, 2));

        PlayerBoundaryEntity.Create(entityManager, new Vector2(boundaryOffset + boundarySize / 2, 0), new Vector2(-1, 0), mesh2D, vertPlayerBoundMat, 2);
        PlayerBoundaryEntity.Create(entityManager, new Vector2(boundaryOffset - boundarySize / 2, 0), new Vector2(1, 0), mesh2D, vertPlayerBoundMat, 2);
        PlayerBoundaryEntity.Create(entityManager, new Vector2(boundaryOffset, -boundarySize / 2), new Vector2(0, 1), mesh2D, horiPlayerBoundMat, 2);
        PlayerBoundaryEntity.Create(entityManager, new Vector2(boundaryOffset, boundarySize / 2), new Vector2(0, -1), mesh2D, horiPlayerBoundMat, 2);

        PlayerBoundaryEntity.Create(entityManager, new Vector2(-boundaryOffset - boundarySize / 2, 0), new Vector2(1, 0), mesh2D, vertPlayerBoundMat, 1);
        PlayerBoundaryEntity.Create(entityManager, new Vector2(-boundaryOffset + boundarySize / 2, 0), new Vector2(-1, 0), mesh2D, vertPlayerBoundMat, 1);
        PlayerBoundaryEntity.Create(entityManager, new Vector2(-boundaryOffset, -boundarySize / 2), new Vector2(0, 1), mesh2D, horiPlayerBoundMat, 1);
        PlayerBoundaryEntity.Create(entityManager, new Vector2(-boundaryOffset, boundarySize / 2), new Vector2(0, -1), mesh2D, horiPlayerBoundMat, 1);

        ProjectileBoundaryEntity.Create(entityManager, new Vector2(-2.5f * boundaryOffset, 0), new Vector2(1, 0), mesh2D, vertProjectileBoundMat, 20.0f, Color.clear);
        ProjectileBoundaryEntity.Create(entityManager, new Vector2(2.5f * boundaryOffset, 0), new Vector2(-1, 0), mesh2D, vertProjectileBoundMat, 20.0f, Color.clear);
        ProjectileBoundaryEntity.Create(entityManager, new Vector2(0, 1.5f * boundaryOffset), new Vector2(0, -1), mesh2D, horiProjectileBoundMat, 40.3f, Color.clear);
        ProjectileBoundaryEntity.Create(entityManager, new Vector2(0, 1.5f * -boundaryOffset), new Vector2(0, 1), mesh2D, horiProjectileBoundMat, 40.3f, Color.clear);
        CardEntity.Create(entityManager, new Vector2(0, -15f), 0, 0, 0, cardLibrary[0].manaCost, mesh2D, cardLibrary[0].getMaterial());

        EventManager.instance.QueueEvent(new SoundEvent(playDeck1.GetPrimaryString(), "Intro"));
        EventManager.instance.QueueEvent(new SoundEvent(playDeck2.GetPrimaryString(), "Intro", 1f));
        EventManager.instance.QueueEvent(new AnimatorEvent(2, "Intro"));
        EventManager.instance.QueueEvent(new AnimatorEvent(2, "Intro"));
    }
Exemplo n.º 2
0
 public int AddCardToHandFromCardLibrary(int player, int cardSlot, int cardID)
 {
     if (player == 1)
     {
         CardEntity.Create(entityManager, new Vector2(-boundaryOffset - 7, -7.5f), cardID, cardSlot, player, cardLibrary[cardID].manaCost, mesh2D, cardLibrary[cardID].getMaterial());
         return(cardID);
     }
     else
     {
         CardEntity.Create(entityManager, new Vector2(boundaryOffset - 7, -7.5f), cardID, cardSlot, player, cardLibrary[cardID].manaCost, mesh2D, cardLibrary[cardID].getMaterial());
         return(cardID);
     }
 }
Exemplo n.º 3
0
    public bool AddCardtoHand(int cardID)
    {
        int nextSlot = FindOpenHandSlot(cardID);

        if (nextSlot != -1)
        {
            CardEntity.Create(entityManager, new Vector2(boundaryOffset - 7, -7.5f), cardID, nextSlot, 1, cl.GetAllByID()[cardID].manaCost, mesh2D, cl.GetAllByID()[cardID].getMaterial());
            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemplo n.º 4
0
 public int DrawCardFromDeck(int player, int cardSlot)
 {
     if (player == 1)
     {
         int nextCard = playDeck1.DrawCard();
         Debug.Log("NextCard: " + nextCard);
         if (nextCard > 0)
         {
             CardEntity.Create(entityManager, new Vector2(-boundaryOffset - 7, -7.5f), nextCard, cardSlot, player, cardLibrary[nextCard].manaCost, mesh2D, cardLibrary[nextCard].getMaterial());
         }
         //else playDeck1.Shuffle();
         return(nextCard);
     }
     else
     {
         int nextCard = playDeck2.DrawCard();
         if (nextCard != 0)
         {
             CardEntity.Create(entityManager, new Vector2(boundaryOffset - 7, -7.5f), nextCard, cardSlot, player, cardLibrary[nextCard].manaCost, mesh2D, cardLibrary[nextCard].getMaterial());
         }
         //else playDeck2.Shuffle();
         return(nextCard);
     }
 }
Exemplo n.º 5
0
 public int AddCardToHandFromCardLibrary(int player, int cardSlot, int cardID)
 {
     CardEntity.Create(entityManager, new Vector2(boundaryOffset - 7, -7.5f), cardID, cardSlot, 1, cl.GetAllByID()[cardID].manaCost, mesh2D, cl.GetAllByID()[cardID].getMaterial());
     playerHand[cardSlot - 1] = cardID;
     return(cardID);
 }