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