Files cleanup, added summoner code

This commit is contained in:
Szymon Miś
2025-11-20 14:34:59 +01:00
parent 78ed61380e
commit 3245780fa7
104 changed files with 3175 additions and 1049 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 05db168aa73c6d7489b4930e8ac0f2ce
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,23 @@
using RootMotion.FinalIK;
using UnityEngine;
public class LookAtPlayerInitialization : MonoBehaviour
{
public LookAtIK lookAtIK;
public string playerTag = "Player";
private Transform player;
private void OnEnable()
{
GameObject playerObj = GameObject.FindGameObjectWithTag(playerTag);
if (playerObj != null)
{
player = playerObj.transform;
if (lookAtIK != null)
{
lookAtIK.solver.target = player;
lookAtIK.solver.IKPositionWeight = 1f;
}
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 529e37587f83e4b4893a5814cd0cb915

View File

@@ -0,0 +1,48 @@
using UnityEngine;
public class RandomizeAnimatorIntWeighted : StateMachineBehaviour
{
[Header("Animator parameter name (must be int type)")]
public string parameterName = "Randomized";
[Header("Weights for each slot (index = int value)")]
public int[] weights = { 35, 35, 15, 15 };
// Example: {70, 20, 10} means index 0 has 70% chance, 1 has 20%, 2 has 10%
// Called when the animator enters this state
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (weights == null || weights.Length == 0)
{
return;
}
int total = 0;
foreach (int w in weights)
{
total += Mathf.Max(0, w);
}
if (total <= 0)
{
return;
}
int randomValue = Random.Range(0, total);
int cumulative = 0;
int chosenIndex = 0;
for (int i = 0; i < weights.Length; i++)
{
cumulative += Mathf.Max(0, weights[i]);
if (randomValue < cumulative)
{
chosenIndex = i;
break;
}
}
animator.SetFloat(parameterName, (float)chosenIndex);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d20bc7e4150a82f4ba03191390f832f8