Пример #1
0
    public void OnPlayerPlantTree(p3AbsTree t, p3Player p, int deltaTurn)
    {
        tree = t;
        tree.OnBeingPlant(p, deltaTurn);

        t.transform.position = transform.position;
        t.cell = this;
    }
Пример #2
0
 public override void OnBeingChoped(p3Player player, p3Cell sourceCell, int tier, int ac)
 {
     if (player != source & tier == 0 & state != StaticStructure.TreeState.InSeed)
     {
         return;
     }
     base.OnBeingChoped(player, sourceCell, tier, ac);
 }
Пример #3
0
    public override void OnBeingPlant(p3Player p, int deltaTurn)
    {
        base.OnBeingPlant(p, deltaTurn);
        turnToLifeCounter = -1;

        state = StaticStructure.TreeState.Grown;
        graphicalModel.localScale = originScale;
    }
Пример #4
0
 protected override void ActivateOnFall(p3Player player)
 {
     foreach (var p in affected)
     {
         p.bonus.moveCost -= moveAdditionalCost;
     }
     affected.Clear();
 }
Пример #5
0
    virtual public void OnBeingPlant(p3Player p, int deltaTurn)
    {
        turnToLifeCounter = defaultTurnToLife + deltaTurn;
        p3Scene.Instance.treesInScene.Add(this);

        fx      = 0;
        fz      = 0;
        dealDmg = false;
        state   = TreeState.InSeed;
        graphicalModel.localScale = startScale;
    }
Пример #6
0
 public void OnPlayerChop(p3Player p, p3Cell chopedCell, int acCost)
 {
     if (chopedCell.tree != null)
     {
         chopedCell.tree.OnBeingChoped(p, p.currentCell, 0, acCost);
     }
     if (chopedCell.player != null & chopedCell.player != p)
     {
         chopedCell.player.OnBeingChoped(p, acCost);
     }
 }
Пример #7
0
 public void Reset()
 {
     if (tree != null)
     {
         tree.gameObject.SetActive(false);
     }
     tree   = null;
     player = null;
     highlight.SetActive(false);
     selected.SetActive(false);
     aura.SetActive(false);
 }
Пример #8
0
 public void OnPlayerLoaded(p3Player player)
 {
     if (player.photonView.isMine)
     {
         playerMineLoaded = true;
     }
     else
     {
         playerNotMineLoaded = true;
     }
     TrySettingUpScene();
 }
Пример #9
0
    virtual public void OnBeingChoped(p3Player player, p3Cell 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 (tier == 0)
        {
            player.OnChopDone(acCost);
        }

        if (!(fx == 0 & fz == 0))
        {
            fallingQuat     = Angle.Convert(fx, fz);
            dominoDelayTime = tier * p3Scene.Instance.globalDominoDelay;

            if (PassDominoFuther())
            {
                p3Cell 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
            {
                Debug.Log("state == TreeState.InSeed ? " + (state == TreeState.InSeed));
                player.OnCredit(state == TreeState.InSeed? tier - 1 : tier);
            }

            dealDmg = state != TreeState.InSeed;
            state   = TreeState.WaitDomino;
        }
    }
Пример #10
0
 public void OnBeingChoped(p3Player chopper, int acCost)
 {
     if (photonView.isMine & basic.hp > 0)
     {
         chopper.OnChopDone(acCost);
         if (bonus.hp > 0)
         {
             bonus.hp--;
         }
         else
         {
             basic.hp--;
         }
         gui.ingamePanel.infoBar.myHp.text = "HP: " + (basic.hp + bonus.hp).ToString();
         if (basic.hp == 0)
         {
             globalScene.OnVictoryConditionsReached(chopper.photonView.owner.ID);
         }
     }
 }
Пример #11
0
 protected override void ActivateOnChop(p3Player player, ref int fx, ref int fz)
 {
     fx = 0;
     fz = 0;
 }
Пример #12
0
 virtual protected void ActivateOnFall(p3Player player)
 {
 }
Пример #13
0
 virtual protected void ActivateOnChop(p3Player player, ref int fx, ref int fz)
 {
 }
Пример #14
0
 public override void OnBeingPlant(p3Player p, int deltaTurn)
 {
     base.OnBeingPlant(p, deltaTurn);
     source = p;
 }
Пример #15
0
 public void OnPlayerMoveOut( )
 {
     this.player = null;
 }
Пример #16
0
 public void OnPlayerMoveIn(p3Player player)
 {
     player.transform.position = transform.position;
     player.currentCell        = this;
     this.player = player;
 }
Пример #17
0
 public void OnBackgroundStart(p3Player invoker, int treenb)
 {
     SceneGenTree(treenb);
     photonView.RPC("_OnBackgroundStart", PhotonTargets.All);
 }