Example #1
0
        public static bool AddDoorConfig(string prefabName, DoorConfig doorConfig)
        {
            int hashCode = prefabName.GetStableHashCode();

            if (specificDoors.ContainsKey(hashCode))
            {
                return(false);
            }

            specificDoors.Add(hashCode, doorConfig);
            return(true);
        }
Example #2
0
        public static bool AddDoorConfig(Door door, DoorConfig doorConfig)
        {
            if (!door.TryGetComponent(out DoorPowerState doorPowerState))
            {
                doorPowerState = door.gameObject.AddComponent <DoorPowerState>();
            }

            if (specificDoors.ContainsKey(doorPowerState.GetPrefabId()))
            {
                return(false);
            }

            specificDoors.Add(doorPowerState.GetPrefabId(), doorConfig);
            return(true);
        }
        public int GetState()
        {
            if (!IsReallySpawned(out ZNetView zNetView))
            {
                return(0);
            }

            int        state      = zNetView.GetZDO().GetInt("state");
            DoorConfig doorConfig = GetDoorConfig();

            if (doorConfig == null)
            {
                return(state);
            }

            if (doorConfig.openClosedInverted)
            {
                state = 1 - Math.Abs(state);
            }

            return(state);
        }
 public DoorConfig GetDoorConfig()
 {
     return(DoorConfig.GetDoorConfig(this));
 }