Ejemplo n.º 1
0
        public NetworkCell ToNetworkCell()
        {
            NetworkCell netCell = new NetworkCell();

            netCell.block = block.ToNetworkBlock();
            netCell.x     = x;
            netCell.y     = y;
            return(netCell);
        }
Ejemplo n.º 2
0
 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>();
 }
Ejemplo n.º 3
0
 public NetworkTeam GetTeam(NetworkCell cell)
 {
     foreach (NetworkTeam team in teams_)
     {
         if (team.HasCell_(cell))
         {
             return(team);
         }
     }
     return(null);
 }
Ejemplo n.º 4
0
 public int GetTeamId(NetworkCell cell)
 {
     foreach (NetworkTeam team in teams_)
     {
         if (team.HasCell_(cell))
         {
             return(team.TeamId_);
         }
     }
     return(-1);
 }
Ejemplo n.º 5
0
 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();
             }
         }
     }
 }
Ejemplo n.º 6
0
    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();
    }
Ejemplo n.º 7
0
 public void Initialize(NetworkCell cell, Transform cellTransform)
 {
     cell_           = cell;
     cellTransoform_ = cellTransform;
     text_           = GetComponent <Text>();
 }