convert unity game script into phaser js typescript. we are trying to migrate game from…
- User
convert unity game script into phaser js typescript. we are trying to migrate game from unity to phaser:
public class dungeonManager : MonoBehaviour { public struct keyStruct { public GameObject keyObj;
public GameObject keyPrefab; public tk2dAnimatedSprite spr; public Transform selfTransform; public bool clicked; public keyStruct(string nullStuct) { keyPrefab = Resources.Load("sprAnimObj") as GameObject; GameObject gameObject = (keyObj = UnityEngine.Object.Instantiate(keyPrefab, new Vector3(-9999f, 0f, 0f), Quaternion.identity) as GameObject); clicked = false; selfTransform = keyObj.transform; BoxCollider boxCollider = gameObject.AddComponent<BoxCollider>(); boxCollider.size = new Vector3(100f, 150f, 0.1f); gameObject.AddComponent<eventObject>().eventName = "openDoor"; gameObject.GetComponent<eventObject>().isCoroutine = true; gameObject.GetComponent<eventObject>().isDestroy = false; spr = gameObject.GetComponent<tk2dAnimatedSprite>(); gameObject.GetComponent<eventObject>().selfSprite = spr; spr.SwitchCollectionAndSprite(use.sprDatas[0], 22); spr.anim = (tk2dSpriteAnimation)Resources.Load("animations/spriteAnimations", typeof(tk2dSpriteAnimation)); } public IEnumerator ObjectShake(Transform tr) { while (!clicked) { yield return use.StartCoroutine(SlideOffSet(tr, 15f, 1.4f)); yield return use.StartCoroutine(SlideOffSet(tr, -15f, 1f)); } } public IEnumerator SlideOffSet(Transform obTransform, float end, float timer) { if (!(obTransform == null)) { float t = 0f; Vector3 start = obTransform.position; while (t < 1f && !(obTransform == null) && !clicked) { t += Time.deltaTime * (1f / timer); obTransform.position = new Vector3(obTransform.position.x, Mathf.Lerp(start.y, start.y + end, 1f - Mathf.Cos(t * (float)Math.PI * 0.5f)), obTransform.position.z); yield return true; } } } public IEnumerator MoveToExit(Vector3 exitPos) { clicked = true; dungeonGenerator.use.StartCoroutine(soundManager.Instance.playSound(res.music["Pickup_Key_01"])); yield return new WaitForSeconds(0.1f); yield return use.StartCoroutine(tween.use.moveAndrot(selfTransform, new Vector3(exitPos.x, exitPos.y, -9f), 700f)); } } public const int guiLayerId = 9; public const int guiActionBarId = 14; [SerializeField] private tk2dSlicedSprite bgSplash; [SerializeField] private Color bloodSplashColor; [SerializeField] private Color normalSplashColor; public tk2dSlicedSprite blackBg; public dungeonGenerator dGClass; public List<cellTile> TileList = new List<cellTile>(); public List<cellTile> ArenaList = new List<cellTile>(); public tk2dTextMesh heartAmountT; public tk2dTextMesh swordAmountT; public tk2dTextMesh foodAmountT; public GameObject dustPrefab; public GameObject splash_swordPrefab; public GameObject poofPrefab; public GameObject sparkPrefab; public GameObject bloodSplashPrefab; public GameObject spritePrefab; public GameObject fxAnimPrefab; public GameObject lootInformerPrefab; public GameObject textPrefab; public bool isArena; public int openCellsCashed; public tk2dSpriteCollectionData[] sprDatas = new tk2dSpriteCollectionData[5]; public Dictionary<int, monster> activeMobs = new Dictionary<int, monster>(); public List<monster> allMobs = new List<monster>(); public Dictionary<int, monster> arenaMobs = new Dictionary<int, monster>(); public Dictionary<int, monster> tempMonsterContainer = new Dictionary<int, monster>(); public Dictionary<string, miniAchievement> miniAchievementList = new Dictionary<string, miniAchievement>(); public cellTile exitCellTemp; public keyStruct key; public bool haveMasterKey; public int activeBarSlots = 1; public int maxWeight = 10; public int _currentWeight; public float CRIT_RATE; public int initiativeChance = 1; public int critChance; public int missChance; private int _swordAmount; private int _atBufs; private int _atDebufs; private int _weaponBuff; public static dungeonManager use; public static bool isGamePaused; public GameObjectPool dustEffectPool; public GameObjectPool bloodSplatEffectPool; public GameObjectPool poofEffectPool; public GameObjectPool chestEffectPool; public GameObjectPool splashEffectPool; private bool overTemp; public int _arenaKilled; public int moneyReward; public int hpReward; public int swordReward; private int _killedEnemies; private int _pesantSaved; public bool isOneShot; public bool magicUsed; public bool haveLantern; public int challengeKilledEnemies; public bool questEnd; public Queue<string> menuQueue = new Queue<string>(); private bool showingMenu; - Assistant
- User
what is this? convert and show all line by line
- Assistant
- User
show complete typescript class
- Assistant
- User
error in slideoffset - property elapsed does not exist on type clock
- Assistant
- User
why didn't you implement tweenMoveAndRotate?
- Assistant
- User
convert this method of dungeonmanager to phaser typescript:
public int goldAmount { get { return gameState.Instance.coins; } set { achieveState.Instance.coinTOTAL += value; gameState.Instance.coins = value; } }
- Assistant
- User
i've got source for AchieveState class, convert it public class achieveState : MonoBehaviour { public static achieveState instance;
private int _coinTOTAL; private int _fireballTOTAL; private int _freezeTOTAL; private int _polymophTOTAL; private int _ressurectTime; private int _trap; private int _gladiator; private int _scrolls; private int _loot; private int _clear; - Assistant
- User
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.