public void OnPlayerPlantTree(AbsTree t, p2Player p, int deltaTurn) { tree = t; tree.OnBeingPlant(p, deltaTurn); t.transform.position = transform.position; t.cell = this; }
virtual public void OnBeingPlant(p2Player p, int deltaTurn) { turnToLifeCounter = defaultTurnToLife + deltaTurn; p2Scene.Instance.treesInScene.Add(this); fx = 0; fz = 0; dealDmg = false; state = TreeState.InSeed; graphicalModel.localScale = startScale; }
//List<p2FallRecord > markedToFallList = new List<p2FallRecord>(); // bool hasJobInThisTurn = false; public void OnPlayerChop(p2Player p, p2Cell 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); } }
public void Reset() { if (tree != null) { tree.gameObject.SetActive(false); } tree = null; player = null; highlight.SetActive(false); selected.SetActive(false); }
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; } }
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); } } }
public void OnPlayerReady(p2Player p) { if (!players.Contains(p)) { players.Add(p); } p.gameObject.SetActive(false); if (!PhotonNetwork.isMasterClient & player_verf_count >= PhotonNetwork.room.maxPlayers) { photonView.RPC("NonMasterClientReady", PhotonTargets.MasterClient); } if (PhotonNetwork.isMasterClient & player_verf_count >= PhotonNetwork.room.maxPlayers) { masterReady = true; if (nonMasterReady & !_run) { photonView.RPC("OnGameStart", PhotonTargets.All, Random.Range(0, 2)); } } }
virtual protected void ActivateOnFall(p2Player player) { }
virtual protected void ActivateOnChop(p2Player player, ref int fx, ref int fz) { }
public void OnBackgroundStart(p2Player invoker, int treenb) { SceneGenTree(treenb); photonView.RPC("_OnBackgroundStart", PhotonTargets.All); }
virtual public void OnBuffRemovedFromPlayer(p2Player p) { targets.Remove(p); }
virtual public void ApplyBuff(p2Player _target) { targets.Add(_target); }
abstract protected void Activate(p2Player _invoker);
public void OnPlayerMoveOut( ) { this.player = null; }
public void OnPlayerMoveIn(p2Player player) { player.transform.position = transform.position; player.currentCell = this; this.player = player; }