using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// 从天上召唤一个小怪 /// public class DropANormalEnemy : EntryTrigger { /// /// 要召唤的怪物 /// public GameObject enemy; private NormalEnemy temp; public override void OnCall(){ temp = Instantiate( enemy, new Vector3(4.69999981f,6.46999979f,-0.492015928f), Quaternion.identity ).GetComponent(); temp.transform.localScale = new Vector3( temp.transform.localScale.x * -1, temp.transform.localScale.y, temp.transform.localScale.z ); temp.needWalk = false; temp.GetComponent().gravityScale = 2f; Invoke("MakeItFollowTheGround",1f); } private void MakeItFollowTheGround(){ temp.HPLeft = 1; temp.transform.SetParent( GameObject.Find("浮空平台").transform.Find("浮空平台5") ); temp.GetComponent().constraints = RigidbodyConstraints2D.FreezeAll; } }