38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
![]() |
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
/// <summary>
|
||
|
/// 从天上召唤一个小怪
|
||
|
/// </summary>
|
||
|
public class DropANormalEnemy : Event
|
||
|
{
|
||
|
/// <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;
|
||
|
Invoke("MakeItFollowTheGround",0.5f);
|
||
|
}
|
||
|
|
||
|
private void MakeItFollowTheGround(){
|
||
|
temp.HPLeft = 1;
|
||
|
temp.transform.SetParent(
|
||
|
GameObject.Find("浮空平台").transform.Find("浮空平台5")
|
||
|
);
|
||
|
}
|
||
|
}
|