Initial commit: Unity WordConnect project

This commit is contained in:
2025-08-01 19:12:05 +08:00
commit f14db75802
3503 changed files with 448337 additions and 0 deletions

View File

@ -0,0 +1,34 @@
// // ©2015 - 2025 Candy Smith
// // All rights reserved
// // Redistribution of this software is strictly not allowed.
// // Copy of this software can be obtained from unity asset store only.
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// // THE SOFTWARE.
using UnityEngine;
using WordsToolkit.Scripts.GUI;
using WordsToolkit.Scripts.GUI.Buttons;
namespace WordsToolkit.Scripts.AnimationBehaviours
{
public class CallButtonMethod : StateMachineBehaviour
{
[SerializeField]
private string exitMethod;
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
base.OnStateEnter(animator, stateInfo, layerIndex);
var component = animator.gameObject.GetComponent<CustomButton>();
if (component != null)
{
component.Invoke(exitMethod, 0.3f);
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f1c162818dc149328fa1dcb096a8f7ff
timeCreated: 1730970355

View File

@ -0,0 +1,32 @@
// // ©2015 - 2025 Candy Smith
// // All rights reserved
// // Redistribution of this software is strictly not allowed.
// // Copy of this software can be obtained from unity asset store only.
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// // THE SOFTWARE.
using UnityEngine;
using WordsToolkit.Scripts.Popups;
namespace WordsToolkit.Scripts.AnimationBehaviours
{
public class CallPopupMethod : StateMachineBehaviour
{
[SerializeField]
private string methodName;
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
var component = animator.gameObject.GetComponent<Popup>();
if (component != null)
{
component.Invoke(methodName, 0f);
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 23b520ef875a4cd1bbf46b02714dfcce
timeCreated: 1729076432

View File

@ -0,0 +1,54 @@
// // ©2015 - 2025 Candy Smith
// // All rights reserved
// // Redistribution of this software is strictly not allowed.
// // Copy of this software can be obtained from unity asset store only.
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// // THE SOFTWARE.
using UnityEngine;
using UnityEngine.Serialization;
namespace WordsToolkit.Scripts.AnimationBehaviours
{
public class DelayBeforeStart : StateMachineBehaviour
{
private float delay;
private bool hasStartedOnce;
[FormerlySerializedAs("randomMax")]
[SerializeField]
private float delayMax;
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (!hasStartedOnce)
{
delay = delayMax;
animator.speed = 0;
}
else
{
animator.speed = 1;
}
}
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (!hasStartedOnce)
{
delay -= Time.deltaTime;
if (delay <= 0)
{
animator.speed = 1;
hasStartedOnce = true;
}
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c20ba3464f284bed8370fcefe71e9b5d
timeCreated: 1694162792

View File

@ -0,0 +1,52 @@
// // ©2015 - 2025 Candy Smith
// // All rights reserved
// // Redistribution of this software is strictly not allowed.
// // Copy of this software can be obtained from unity asset store only.
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// // THE SOFTWARE.
using UnityEngine;
namespace WordsToolkit.Scripts.AnimationBehaviours
{
public class RandomDelayBeforeStart : StateMachineBehaviour
{
private float delay;
private bool hasStartedOnce;
[SerializeField]
private float randomMax;
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (!hasStartedOnce)
{
delay = Random.Range(0.0f, randomMax);
animator.speed = 0;
}
else
{
animator.speed = 1;
}
}
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (!hasStartedOnce)
{
delay -= Time.deltaTime;
if (delay <= 0)
{
animator.speed = 1;
hasStartedOnce = true;
}
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ed32b723e2bb24e4598e155511c98198
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,47 @@
// // ©2015 - 2025 Candy Smith
// // All rights reserved
// // Redistribution of this software is strictly not allowed.
// // Copy of this software can be obtained from unity asset store only.
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// // THE SOFTWARE.
using System.Collections.Generic;
using UnityEngine;
namespace WordsToolkit.Scripts.AnimationBehaviours
{
public class RandomTransitionBehaviour : StateMachineBehaviour
{
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
// Get all parameters of the animator
var parameters = animator.parameters;
// Filter and store trigger parameters
var triggerParams = new List<AnimatorControllerParameter>();
foreach (var param in parameters)
{
if (param.type == AnimatorControllerParameterType.Trigger)
{
triggerParams.Add(param);
}
}
// Check if there are any trigger parameters
if (triggerParams.Count > 0)
{
// Select a random trigger
var randomIndex = Random.Range(0, triggerParams.Count);
var randomTriggerName = triggerParams[randomIndex].name;
// Set the random trigger
animator.SetTrigger(randomTriggerName);
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5f71eb9df3f54f26a7fca082f2b165bc
timeCreated: 1726207741

View File

@ -0,0 +1,39 @@
// // ©2015 - 2025 Candy Smith
// // All rights reserved
// // Redistribution of this software is strictly not allowed.
// // Copy of this software can be obtained from unity asset store only.
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// // THE SOFTWARE.
using UnityEngine;
namespace WordsToolkit.Scripts.AnimationBehaviours
{
public class RandomWaitTime : StateMachineBehaviour
{
public float minWaitTime = 2f;
public float maxWaitTime = 5f;
private float nextChangeTime;
private bool isPlaying;
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
nextChangeTime = Time.time + Random.Range(minWaitTime, maxWaitTime);
}
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (Time.time >= nextChangeTime)
{
isPlaying = !isPlaying;
animator.speed = isPlaying ? 1 : 0;
nextChangeTime = Time.time + Random.Range(minWaitTime, maxWaitTime);
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8d28431513d24508bed75d96f343e797
timeCreated: 1694366333

View File

@ -0,0 +1,52 @@
// // ©2015 - 2025 Candy Smith
// // All rights reserved
// // Redistribution of this software is strictly not allowed.
// // Copy of this software can be obtained from unity asset store only.
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// // THE SOFTWARE.
using UnityEngine;
namespace WordsToolkit.Scripts.AnimationBehaviours
{
public class RandomizedState : StateMachineBehaviour
{
[Header("Add RandomFinished trigger to transition to next state")]
[SerializeField]
private float minTime = 2f;
[SerializeField]
private float maxTime = 4f;
[SerializeField]
private string randomfinishedStr = "RandomFinished";
private float currentTimeBeforeBlink;
private float timeElapsed;
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
Randomize();
}
private void Randomize()
{
currentTimeBeforeBlink = Random.Range(minTime, maxTime);
timeElapsed = 0f;
}
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
timeElapsed += Time.deltaTime;
if (timeElapsed >= currentTimeBeforeBlink)
{
animator.SetTrigger(Animator.StringToHash(randomfinishedStr));
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 92be39a43ff94817ad00fc3b7349e4a8
timeCreated: 1692957436