Ejemplo n.º 1
0
        // Must hook before the drone is actually scaled, to move the parent trigger to the root entity.
        // This is done to prevent issues where the player observes the entity they are parented to resize.
        private void OnDroneScaleBegin(Drone drone, BaseEntity rootEntity, float scale, float previousScale)
        {
            if (previousScale == 1)
            {
                var platform = drone.GetComponent <DronePlatformComponent>();
                if (platform == null)
                {
                    return;
                }

                // Move parent trigger to root entity.
                UnityEngine.Object.DestroyImmediate(platform);
                DronePlatformComponent.AddToRootEntity(drone, rootEntity, scale);
                return;
            }

            if (scale == 1)
            {
                var platform = rootEntity.GetComponent <DronePlatformComponent>();
                if (platform == null)
                {
                    return;
                }

                // Move parent trigger to drone.
                UnityEngine.Object.DestroyImmediate(platform);
                drone.Invoke(() => DronePlatformComponent.AddToDrone(drone, scale), 0);
                return;
            }

            rootEntity.GetOrAddComponent <DronePlatformComponent>().SetScale(scale);
        }
Ejemplo n.º 2
0
        private static bool TryCreatePlatform(Drone drone)
        {
            if (CreatePlatformWasBlocked(drone))
            {
                return(false);
            }

            DronePlatformComponent.AddToDroneOrRootEntity(drone, GetDroneScale(drone));
            Interface.CallHook("OnDroneParentTriggerCreated", drone);

            return(true);
        }
Ejemplo n.º 3
0
 private void Unload()
 {
     DronePlatformComponent.DestroyAll();
     _pluginInstance = null;
 }