Beispiel #1
0
    public void abilityCast(uint ownerID, uint abilID, uint tileID)
    {
        if (!messageCheck(ownerID, abilID, tileID))
        {
            return;
        }
        Ordnance    castAbility = NetworkIdentity.spawned[abilID].GetComponent <Ordnance>();
        PlayerGhost player      = NetworkIdentity.spawned[ownerID].GetComponent <PlayerGhost>();
        Targeting   t           = castAbility.GetComponent <Targeting>();
        Tile        target      = NetworkIdentity.spawned[tileID].GetComponent <Tile>();


        if (
            castAbility &&
            player.getCurrentResources() >= castAbility.resourceCost &&
            castAbility.caster.canCast
            //&& t.evaluate(target, teams[ownerID], castAbility.caster.loc) //Inside cast now
            )
        {
            if (castAbility.castAbil(target, castAbility.getTeam(), castAbility.caster.loc))
            {
                player.spendResources(castAbility.resourceCost);
                pipe.RpcAddViewEvent(new ViewEvent(ViewType.playEffect, abilID, tileID, Time.time));
            }
        }
    }
Beispiel #2
0
    public void cardPlay(uint ownerID, uint cardID, uint tileID)
    {
        if (!messageCheck(ownerID, cardID, tileID))
        {
            return;
        }
        Card        playedCard = NetworkIdentity.spawned[cardID].GetComponent <Card>();
        PlayerGhost player     = NetworkIdentity.spawned[ownerID].GetComponent <PlayerGhost>();
        Targeting   t          = playedCard.GetComponent <Targeting>();
        Tile        target     = NetworkIdentity.spawned[tileID].GetComponent <Tile>();


        if (
            playedCard &&
            player.getCurrentResources() >= playedCard.resourceCost &&
            player.getCurrentSpendLimit() >= playedCard.resourceCost &&
            t.evaluate(target, teams[ownerID])
            )
        {
            player.spendResources(playedCard.resourceCost);
            playedCard.playCard(target);
            delayedDestroy(playedCard.gameObject);
        }
    }