public void PlaceDefense() { var mousePos = this.GetViewport().GetMousePosition(); var to = this.ChildCamera.ProjectRayNormal(mousePos) * 1000; ChildRayCast.Transform = this.ChildCamera.Transform; ChildRayCast.CastTo = ChildRayCast.ToLocal(to); ChildRayCast.ForceRaycastUpdate(); if (ChildRayCast.IsColliding()) { Vector3 collisionPoint = ChildRayCast.GetCollisionPoint(); var tileLoc = new Vector3Int(OwnerMap.WorldToMap(collisionPoint)); var tile = OwnerMap.GetMapTile(tileLoc); if (tile?.Type == TileType.BUILDABLE) { var newTower = Tower1.Instance() as Tower; newTower.Transform = new Transform { basis = Basis.Identity, origin = OwnerMap.MapToWorld( tileLoc.X, tileLoc.Y, tileLoc.Z ) }; this.GetTree().Root.AddChild(newTower); } } }
public void Constructor_NoInputs_IsInstanceOfClassMappingOwner() { var sut = new OwnerMap(); sut.ShouldBeInstanceOf<ClassMap<Owner>>(); }