public CEntityPlacer(string AssetName, Transform Parent, PlacementDelegate PlacementDelegate) { mAsset = CGame.AssetManager.GetAsset <CItemAsset>(AssetName); if (mAsset == null) { Debug.LogError("Can't asset to place: " + AssetName); return; } _Init(EPlaceType.ITEM, Parent, PlacementDelegate); }
private void _Init(EPlaceType Type, Transform Parent, PlacementDelegate PlacementDelegate) { mType = Type; _placeable = false; _placeDelegate = PlacementDelegate; if (mType == EPlaceType.ITEM) { _gob = mAsset.CreateVisuals(EViewDirection.VD_FRONT); _gob.transform.SetParent(Parent); CItemView.SetItemSurfaceColour(mAsset.mItemType, _gob, CGame.COLOR_BLUEPRRINT); } else if (mType == EPlaceType.UNIT) { mRotation = 225; _gob = GameObject.Instantiate(CGame.PrimaryResources.Prefabs[7] as GameObject); _gob.transform.SetParent(Parent); _gob.transform.rotation = Quaternion.AngleAxis(mRotation, Vector3.up); } }
public CEntityPlacer(EPlaceType Type, Transform Parent, PlacementDelegate PlacementDelegate) { _Init(Type, Parent, PlacementDelegate); }