Files
BepInEx/Projects/BanquetForFools/Source/Assembly-CSharp/SpellVine.cs
2025-05-21 20:40:04 +02:00

132 lines
3.3 KiB
C#

using System;
using DarkTonic.MasterAudio;
using UnityEngine;
// Token: 0x0200004F RID: 79
public class SpellVine : MonoBehaviour
{
// Token: 0x0600090B RID: 2315 RVA: 0x000C23FC File Offset: 0x000C05FC
private void Start()
{
this.startPosition = base.gameObject.transform.position;
this.t = 0f;
this.action.vineComplete = false;
if (this.target)
{
this.hasTarget = true;
}
this.fx = null;
this.fx = Links.x.cellar.GetPooledGameObject(24);
if (this.hasTarget)
{
this.targetPosition = this.target.tr.position;
}
this.fx.transform.rotation = Quaternion.LookRotation(this.startPosition - this.targetPosition);
this.distance = Vector3.Distance(this.startPosition, this.targetPosition);
this.fx.transform.position = this.startPosition + new Vector3(0f, 0.1f, 0f);
this.fx.SetActive(true);
this.animator = this.fx.GetComponent<Animator>();
this.animator.Play("Vines_Spell");
this.currentPosition = this.startPosition;
this.moveTime = 0f;
}
// Token: 0x0600090C RID: 2316 RVA: 0x000C2538 File Offset: 0x000C0738
private void Update()
{
if (!this.action && this.targetPosition != Vector3.zero)
{
this.End();
}
if (!Records.x.pocketPause || (Records.x.pocketPause && this.action.character.mainSelected))
{
if (this.hasTarget)
{
this.targetPosition = this.target.tr.position;
}
if ((this.currentPosition - this.targetPosition).sqrMagnitude < 0.1f)
{
this.End();
return;
}
this.t += Time.deltaTime;
if (this.animator.GetCurrentAnimatorStateInfo(0).IsName("Vines_Spell_Loop"))
{
this.moveTime = this.t;
MasterAudio.PlaySound3DAtVector3AndForget("Vine", this.currentPosition, 0.5f, new float?(1f), 0f, "", null);
this.fx.transform.position = this.currentPosition + new Vector3(0f, 0.1f, 0f);
this.animator.Play("Vines_Spell", 0, 0f);
}
this.currentPosition = Vector3.Lerp(this.startPosition, this.targetPosition, this.t / this.desiredSpeed);
}
}
// Token: 0x0600090D RID: 2317 RVA: 0x000C26B7 File Offset: 0x000C08B7
public void End()
{
if (this.fx)
{
Links.x.cellar.ReturnPooledGameObject(24, this.fx);
}
this.action.vineComplete = true;
Object.Destroy(this);
}
// Token: 0x04000E28 RID: 3624
private Vector3 startPosition;
// Token: 0x04000E29 RID: 3625
public Vector3 targetPosition;
// Token: 0x04000E2A RID: 3626
public Actions action;
// Token: 0x04000E2B RID: 3627
public int index;
// Token: 0x04000E2C RID: 3628
private float t;
// Token: 0x04000E2D RID: 3629
private GameObject fx;
// Token: 0x04000E2E RID: 3630
private float moveTime;
// Token: 0x04000E2F RID: 3631
private Vector3 currentPosition;
// Token: 0x04000E30 RID: 3632
private Animator animator;
// Token: 0x04000E31 RID: 3633
private float distance;
// Token: 0x04000E32 RID: 3634
public Library.Abilities vineSpell;
// Token: 0x04000E33 RID: 3635
private bool mainCaster;
// Token: 0x04000E34 RID: 3636
public float severity;
// Token: 0x04000E35 RID: 3637
public float tether;
// Token: 0x04000E36 RID: 3638
private float desiredSpeed = 1f;
// Token: 0x04000E37 RID: 3639
public Character character;
// Token: 0x04000E38 RID: 3640
public Character target;
// Token: 0x04000E39 RID: 3641
public GameObject targetInteractive;
// Token: 0x04000E3A RID: 3642
private bool hasTarget;
}