using System; using UnityEngine; public class LevelScale : MonoBehaviour { public bool onLevelUp = true; public bool onStart; private AttackLevel level; private Vector3 startScale; private bool inited; private void Init() { if (!inited) { inited = true; startScale = base.transform.localScale; } } private void Start() { Init(); level = GetComponent(); if (onStart) { base.transform.localScale *= level.LevelScale(); } if (onLevelUp) { AttackLevel attackLevel = level; attackLevel.LevelUpAction = (Action)Delegate.Combine(attackLevel.LevelUpAction, new Action(LevelUp)); } } public void LevelUp(int lvl) { Init(); base.transform.localScale = startScale * level.LevelScale(); } }