2022-03-05 04:28:56 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
2022-03-14 14:21:05 +00:00
|
|
|
using HeavenStudio.Util;
|
2022-03-05 04:28:56 +00:00
|
|
|
using System;
|
|
|
|
|
2022-03-14 14:21:05 +00:00
|
|
|
namespace HeavenStudio.Games.Scripts_WizardsWaltz
|
2022-03-05 04:28:56 +00:00
|
|
|
{
|
|
|
|
public class MagicFX : MonoBehaviour
|
|
|
|
{
|
|
|
|
public Animator animator;
|
|
|
|
public SpriteRenderer spriteRenderer;
|
|
|
|
public GameObject shimmer;
|
|
|
|
|
2022-03-26 02:08:46 +00:00
|
|
|
public void Awake()
|
2022-03-05 04:28:56 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|