using System.Collections; using System.Collections.Generic; using UnityEngine; namespace BITKit { public class LocationMixer : BITBehavior { [System.Serializable] struct LocationInfo { public Location location; public float weight; } [SerializeField] Dictionary locations = new(); public void SetLocation(Location location, int index = 0, float weight = 0) { locations.Set(index, new() { location = location, weight = weight }); } void LateUpdate() { Location currentLocation = new(); locations.ForEach(x => { if (x.Key is 0) { currentLocation = x.Value.location * x.Value.weight; } else { currentLocation=Location.Lerp(currentLocation,x.Value.location,x.Value.weight); } }); transform.SetPositionAndRotation(currentLocation, currentLocation); } } }