static void Rigidbody2D_constraints(JSVCall vc) { if (vc.bGet) { UnityEngine.Rigidbody2D _this = (UnityEngine.Rigidbody2D)vc.csObj; var result = _this.constraints; JSApi.setEnum((int)JSApi.SetType.Rval, (int)result); } else { UnityEngine.RigidbodyConstraints2D arg0 = (UnityEngine.RigidbodyConstraints2D)JSApi.getEnum((int)JSApi.GetType.Arg); UnityEngine.Rigidbody2D _this = (UnityEngine.Rigidbody2D)vc.csObj; _this.constraints = arg0; } }
IEnumerator deathCo(Vector3 newSpawnPos, float respawnTime) { if (deathEffect) { GameObject DE = Instantiate(deathEffect, gameObject.transform.position, transform.rotation); DE.transform.parent = transform; AudioManager.instance.play("playerDied"); } else { Debug.Log("player death effect not assigned"); } Color oldSpriteColor = Color.white; //freze player because dead UnityEngine.RigidbodyConstraints2D oldConstraints = rigibodyComp.constraints; if (rigibodyComp) { rigibodyComp.constraints = RigidbodyConstraints2D.FreezeAll; } if (animator) { animator.SetBool("IsDead", true); } if (spriteRenderer) { oldSpriteColor = spriteRenderer.color; spriteRenderer.color = Color.black; } yield return(new WaitForSeconds(respawnTime)); if (rigibodyComp) { rigibodyComp.constraints = oldConstraints; } if (animator) { animator.SetBool("IsDead", true); } if (spriteRenderer) { spriteRenderer.color = oldSpriteColor; } //respawn the player transform.position = newSpawnPos; RD.currentHealth = RD.maxHealth; RD.didWeCheckDeath = false; if (PCO.isLocal()) { PCO.isAlive = true; //Debug.Log("local player alive"); } }