mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-30 13:33:07 +00:00
ebeea121ed
I just moved everything that was in start to awake. There are a few other changes I made, like using init functions rather than awake in scripts that depended on something that was initialized in another script's awake (to make sure things always happen in the right order), as well as some other stuff in some specific minigames
33 lines
No EOL
851 B
C#
33 lines
No EOL
851 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using HeavenStudio.Util;
|
|
using System;
|
|
|
|
namespace HeavenStudio.Games.Scripts_WizardsWaltz
|
|
{
|
|
public class MagicFX : MonoBehaviour
|
|
{
|
|
public Animator animator;
|
|
public SpriteRenderer spriteRenderer;
|
|
public GameObject shimmer;
|
|
|
|
public void Awake()
|
|
{
|
|
int order = (int)Math.Round((transform.position.z - 2) * 1000);
|
|
spriteRenderer.sortingOrder = order;
|
|
shimmer.GetComponent<SpriteRenderer>().sortingOrder = order;
|
|
animator.Play("Magic", 0, 0);
|
|
|
|
Rigidbody2D rb2d = gameObject.AddComponent<Rigidbody2D>();
|
|
rb2d.gravityScale = 2.5f;
|
|
}
|
|
|
|
public void Kill()
|
|
{
|
|
Destroy(shimmer);
|
|
Destroy(gameObject);
|
|
}
|
|
|
|
}
|
|
} |