コード例 #1
0
    virtual public void OnBeingChoped(p2Player player, p2Cell sourceCell, int tier, int acCost = 0)
    {
        if (state == TreeState.Falling | state == TreeState.WaitDomino)
        {
            return;
        }
        fx     = cell.x - sourceCell.x;
        fz     = cell.z - sourceCell.z;
        choper = player;

        ActivateOnChop(player, ref fx, ref fz);

        if (!(fx == 0 & fz == 0))
        {
            if (tier == 0)
            {
                player.OnChopDone(acCost);
            }
            fallingQuat     = Angle.Convert(fx, fz);
            dominoDelayTime = tier * p2Scene.Instance.globalDominoDelay;

            if (PassDominoFuther())
            {
                p2Cell c;
                if ((c = cell.Get(fx, fz)) != null)
                {
                    if (c.tree == null ? false : c.tree.CanBeAffectedByDomino())
                    {
                        c.tree.OnBeingChoped(player, cell, tier + 1);
                    }
                    else
                    {
                        player.OnCredit(tier);
                    }
                }
                else
                {
                    player.OnCredit(tier);
                }
            }
            else
            {
                player.OnCredit(state == TreeState.InSeed? tier - 1 : tier);
            }

            dealDmg = state != TreeState.InSeed;
            state   = TreeState.WaitDomino;
        }
    }
コード例 #2
0
ファイル: p2Player.cs プロジェクト: Yetij/LumberjackDuel
 public void OnBeingChoped(p2Player chopper, int acCost)
 {
     if (photonView.isMine & basic.hp > 0)
     {
         chopper.OnChopDone(acCost);
         if (bonus.hp > 0)
         {
             bonus.hp--;
         }
         else
         {
             basic.hp--;
         }
         gui.myHp.text = "HP: " + (basic.hp + bonus.hp).ToString();
         if (basic.hp == 0)
         {
             globalScene.OnVictoryConditionsReached(chopper.photonView.owner.ID);
         }
     }
 }