public void SetMultiSprite(Sprite sprite, ValidateMouseDelegate validationFunction) { SetSprite(sprite, validationFunction); var offsetX = ((sprite.texture.width / MapController.PixelsPerCell) - 1) / 2f; var offsetZ = ((sprite.texture.height / MapController.PixelsPerCell) - 1) / 2f; MouseSpriteRenderer.transform.localPosition = new Vector3(offsetX, 0.1f, offsetZ); }
public void SetSprite(Sprite sprite, ValidateMouseDelegate validationFunction) { MouseSpriteRenderer.sprite = sprite; Validate = validationFunction; _currentSprite = sprite; MouseSpriteRenderer.transform.localPosition = new Vector3(0f, 0.1f, 0f); }
public void SetMesh(string name, ValidateMouseDelegate validationFunction) { Clear(); _meshName = name; var structure = Loc.GetStructureController().InstantiateNewStructureMeshRenderer(name, transform); structure.SetAllMaterial(Loc.GetFileController().BlueprintMaterial); _meshRenderer = structure; Validate = validationFunction; }
public void ShowConstructGhost(Construct construct) { _rotateLeft = () => { construct.RotateRight(); Loc.Current.Get <CursorController>().SetMultiSprite(construct.GetSprite(), (cell) => construct.ValidateStartPos(cell)); }; _rotateRight = () => { construct.RotateLeft(); Loc.Current.Get <CursorController>().SetMultiSprite(construct.GetSprite(), (cell) => construct.ValidateStartPos(cell)); }; Validate = (cell) => construct.ValidateStartPos(cell); Loc.Current.Get <CursorController>().SetMultiSprite(construct.GetSprite(), (cell) => construct.ValidateStartPos(cell)); }