public NetworkCell ToNetworkCell() { NetworkCell netCell = new NetworkCell(); netCell.block = block.ToNetworkBlock(); netCell.x = x; netCell.y = y; return(netCell); }
public NetworkAtTargetState(GameObject target, NetworkTentacle tentacle) { tentacle_ = tentacle; target_ = target; bodyPartRadius_ = 0.2f; pulseTime_ = 0; pulseHoldTime_ = 0.08f; tentacleHead_ = tentacle.Head_.GetComponent <NetworkTentaclePart>(); atCell_ = tentacleHead_.targetGO_.GetComponent <NetworkCell>() != null; targetCell_ = target.GetComponent <NetworkCell>(); }
public NetworkTeam GetTeam(NetworkCell cell) { foreach (NetworkTeam team in teams_) { if (team.HasCell_(cell)) { return(team); } } return(null); }
public int GetTeamId(NetworkCell cell) { foreach (NetworkTeam team in teams_) { if (team.HasCell_(cell)) { return(team.TeamId_); } } return(-1); }
public NetworkToTargetState(GameObject target, NetworkTentacle tentacle) { tentacle_ = tentacle; target_ = target; headDistance_ = Vector3.Distance(tentacle.Head_.transform.position, target_.transform.position); bodyPartRadius_ = 0.2f; nextPartDistance_ = headDistance_ - bodyPartRadius_; headPart_ = tentacle.Head_.GetComponent <NetworkTentaclePart>(); targetCell_ = target_.GetComponent <NetworkCell>(); if (NetworkCell.AreAlly(tentacle_.ParentCell_, targetCell_, tentacle_.ParentCell_.TeamManager_)) { foreach (NetworkTentacle targetTentacle in targetCell_.Tentacles_) { if (targetTentacle.Target_ == tentacle_.ParentCell_.gameObject) { targetTentacle.Retreat(); } } } }
public void ConvertCell(NetworkCell attacker, NetworkCell prey) { NetworkTeam teamAttacker = null; NetworkTeam teamPrey = null; foreach (NetworkTeam team in teams_) { if (team.HasCell_(attacker)) { teamAttacker = team; } if (team.HasCell_(prey)) { teamPrey = team; } } teamPrey.RemoveCell(prey.gameObject); teamAttacker.AddCell(prey.gameObject); ConvertCellClientRpc(teamPrey.TeamCellsArray_, teams_.IndexOf(teamPrey)); ConvertCellClientRpc(teamAttacker.TeamCellsArray_, teams_.IndexOf(teamAttacker)); prey.RetreatAllTentacles(); }
public void Initialize(NetworkCell cell, Transform cellTransform) { cell_ = cell; cellTransoform_ = cellTransform; text_ = GetComponent <Text>(); }