You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.7 KiB
46 lines
1.7 KiB
4 years ago
|
using AX.InputSystem;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using AX.MessageSystem;
|
||
|
using System;
|
||
|
|
||
|
[DisallowMultipleComponent]
|
||
|
public class CloneDisasterWithBlood : CloneBase
|
||
|
{
|
||
|
[SerializeField]
|
||
|
[Tooltip("距离地面距离")]
|
||
|
protected float Height = 0;
|
||
|
public override void Execute(IMessage obj)
|
||
|
{
|
||
|
var gameObjID = (long)obj.Sender;
|
||
|
var data = ((CloneCmdArgs)obj.Data);
|
||
|
if (data.cloneObjType == cloneObjType)
|
||
|
{
|
||
|
var hitPoint = data.hitPos;
|
||
|
Vector3 clonedObjPos = new Vector3(hitPoint.x, hitPoint.y + Height, hitPoint.z);
|
||
|
|
||
|
var clonedObj = EntitiesManager.Instance.CreateObj(clonePrefab, clonedObjPos, transform, gameObjID);
|
||
|
|
||
|
clonedObj.name = CloneObjNameTool.Instance().GetCloneObjectName(cloneObjType);
|
||
|
|
||
|
SelectedObjs.gameObjs.Add(clonedObj);
|
||
|
|
||
|
//设置克隆物体所在楼层属性,属性从点击的对象上获取
|
||
|
var hitObj = EntitiesManager.Instance.GetEntityByID(data.gameObjID);
|
||
|
CloneGameObjInfo hitObjInfo = hitObj.GetComponent<CloneGameObjInfo>();
|
||
|
CloneGameObjInfo cloneObjInfo = clonedObj.GetComponent<CloneGameObjInfo>();
|
||
|
cloneObjInfo.gameObjType = cloneObjType;
|
||
|
cloneObjInfo.buildNum = hitObjInfo.buildNum;
|
||
|
cloneObjInfo.floorNum = hitObjInfo.floorNum;
|
||
|
cloneObjInfo.interlayerNum = hitObjInfo.interlayerNum;
|
||
|
|
||
|
//克隆血条并赋值
|
||
|
GameObject Blood = Resources.Load("Common/BGBlood") as GameObject;
|
||
|
Blood.GetComponent<HaemalStrand>().TargetObj = clonedObj;
|
||
|
//初始血量设置,血量写在哪个脚本?
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|