Skip to content

Commit

Permalink
Merge pull request #8 from Netherlands3D/feature/animation-state
Browse files Browse the repository at this point in the history
Feature/animation state
  • Loading branch information
TomSimons authored Sep 4, 2024
2 parents d0814e7 + 242da65 commit 8b0e541
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.0] - 2023-09-03

### Added
- Added event and property for animation state.

### Fixed
- Fixed initial sun position.

## [1.2.1] - 2023-08-27

### Fixed
Expand Down
6 changes: 5 additions & 1 deletion Runtime/Scripts/SunTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class SunTime : MonoBehaviour
[Header("Events")] public UnityEvent<DateTime> timeOfDayChanged = new();
public UnityEvent<float> timeSpeedChanged = new();
public UnityEvent<bool> useCurrentTimeChanged = new();
public UnityEvent<bool> isAnimatingChanged = new();

private float longitude;
private float latitude;
Expand Down Expand Up @@ -80,6 +81,8 @@ public bool UseCurrentTime
}
}

public bool IsAnimating => animate;

private int frameStep;
private const int gizmoRayLength = 10000;

Expand All @@ -95,7 +98,7 @@ private void Start()
Time = newTime;
}

DetermineCurrentLocationFromOrigin();
RecalculateOrigin();
}

private void OnValidate()
Expand Down Expand Up @@ -124,6 +127,7 @@ private void OnDrawGizmos()
public void ToggleAnimation(bool animate)
{
this.animate = animate;
isAnimatingChanged.Invoke(animate);
}

[Obsolete("Use the Time property instead")]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eu.netherlands3d.sun",
"displayName": "Netherlands3D - Sun, Time of Day and Shadows",
"version": "1.2.1",
"version": "1.3.0",
"unity": "2022.2",
"description": "",
"type": "library",
Expand Down

0 comments on commit 8b0e541

Please sign in to comment.