Client LuaCsForBarotrauma
LocationConnection.cs
1 using Microsoft.Xna.Framework;
2 using System;
3 using System.Collections.Generic;
4 
5 namespace Barotrauma
6 {
8  {
9  public Biome Biome;
10 
11  public float Difficulty;
12 
13  public readonly List<Vector2[]> CrackSegments = new List<Vector2[]>();
14 
15  public bool Passed;
16 
17  public bool Locked;
18 
19  public LevelData LevelData { get; set; }
20 
21  public Vector2 CenterPos
22  {
23  get
24  {
25  return (Locations[0].MapPosition + Locations[1].MapPosition) / 2.0f;
26  }
27  }
28 
29  public Location[] Locations { get; private set; }
30 
31  public float Length
32  {
33  get;
34  private set;
35  }
36 
37  private readonly List<Mission> availableMissions = new List<Mission>();
38  public IEnumerable<Mission> AvailableMissions
39  {
40  get
41  {
42  availableMissions.RemoveAll(m => m.Completed || (m.Failed && !m.Prefab.AllowRetry));
43  return availableMissions;
44  }
45  }
46 
47  public LocationConnection(Location location1, Location location2)
48  {
49  if (location1 == null)
50  {
51  throw new ArgumentException("Invalid location connection: location1 was null");
52  }
53  if (location2 == null)
54  {
55  throw new ArgumentException("Invalid location connection: location2 was null");
56  }
57  if (location1 == location2)
58  {
59  throw new ArgumentException("Invalid location connection: location1 was the same as location2");
60  }
61 
62  Locations = new Location[] { location1, location2 };
63  Length = Vector2.Distance(location1.MapPosition, location2.MapPosition);
64  }
65 
66  public Location OtherLocation(Location location)
67  {
68  if (Locations[0] == location)
69  {
70  return Locations[1];
71  }
72  else if (Locations[1] == location)
73  {
74  return Locations[0];
75  }
76  else
77  {
78  return null;
79  }
80  }
81  }
82 }
readonly List< Vector2[]> CrackSegments
IEnumerable< Mission > AvailableMissions
Location OtherLocation(Location location)
LocationConnection(Location location1, Location location2)
Vector2 MapPosition
Definition: Location.cs:92