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.

38 lines
1.3 KiB

1 year ago
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BuildSystem
{
public class PlaceObject : MonoBehaviour
{
public string nameString="";
1 year ago
public int width;
public int height;
public IsHave[] ishave = new IsHave[4];
public PlaceObjectType[] type = new PlaceObjectType[4];
public RoadType roadType;
1 year ago
public void Init(string nameString,int width,int height,PlaceObjectType[] type,IsHave[] ishave, RoadType roadType) {
1 year ago
this.nameString = nameString;
this.width = width;
this.height = height;
this.type = type;
this.ishave = ishave;
this.roadType = roadType;
1 year ago
}
/// <summary>
/// 设置焦点距离
/// </summary>
/// <param name="pos"></param>
public void SetPosition(Vector3 pos) {
Vector3 target = new Vector3((float)(width * BuildSystemManager.Instance.gridSize) / 2
- (float)(BuildSystemManager.Instance.gridSize * 0.5f),
transform.position.y,
(float)(height * BuildSystemManager.Instance.gridSize) / 2 - (float)(BuildSystemManager.Instance.gridSize * 0.5f));
transform.position = pos + target;
}
}
}