2020-12-22 03:13:43 +00:00
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
2020-04-16 03:08:18 +01:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using Unity.Mathematics;
|
|
|
|
|
|
using static Unity.Mathematics.math;
|
|
|
|
|
|
using float2 = Unity.Mathematics.float2;
|
|
|
|
|
|
|
|
|
|
|
|
public class OrbitalEntity : Entity
|
|
|
|
|
|
{
|
2020-05-10 00:16:33 +01:00
|
|
|
|
public Guid OrbitData;
|
2021-05-02 20:59:45 +01:00
|
|
|
|
public SecurityLevel SecurityLevel;
|
|
|
|
|
|
public float SecurityRadius;
|
2021-05-16 05:24:51 +01:00
|
|
|
|
public LocationStory Story;
|
2021-06-18 12:32:03 +01:00
|
|
|
|
public bool CanTow;
|
2020-04-16 03:08:18 +01:00
|
|
|
|
|
2021-03-14 03:56:49 +00:00
|
|
|
|
public OrbitalEntity(ItemManager itemManager, Zone zone, EquippableItem hull, Guid orbit, EntitySettings settings) : base(itemManager, zone, hull, settings)
|
2020-04-16 03:08:18 +01:00
|
|
|
|
{
|
2020-05-10 00:16:33 +01:00
|
|
|
|
OrbitData = orbit;
|
2020-04-16 03:08:18 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void Update(float delta)
|
|
|
|
|
|
{
|
2020-05-10 00:16:33 +01:00
|
|
|
|
if (OrbitData != Guid.Empty)
|
|
|
|
|
|
{
|
2021-01-06 14:56:39 +00:00
|
|
|
|
Position.xz = Zone.GetOrbitPosition(OrbitData);
|
2020-11-27 22:47:33 +00:00
|
|
|
|
Velocity = Zone.GetOrbitVelocity(OrbitData);
|
2020-05-10 00:16:33 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-16 03:08:18 +01:00
|
|
|
|
base.Update(delta);
|
|
|
|
|
|
}
|
2021-05-11 04:45:42 +01:00
|
|
|
|
|
|
|
|
|
|
public bool IsSecureArea
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (SecurityRadius < 1) return false;
|
|
|
|
|
|
if (Faction == null) return false;
|
2021-05-14 03:03:28 +01:00
|
|
|
|
return !IsPresencePermitted(Zone.Galaxy.FactionRelationships[Faction], SecurityLevel);
|
2021-05-11 04:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-04-16 03:08:18 +01:00
|
|
|
|
}
|